i hope you are able to help me.
I have two hosts on Oracle Cloud (one instance with two VNIC (Virtual Network Interface Cards).
Each host has an own public IP and an own private IP.
I want to host two SWAG-Containers with individual domains.
Both containers are up and running, but i only reach the first one per browser.
I added the docker-compose file in both configs:
ports:
private IP:internal port: external port
And of course i added the server name to the swag config.
But i still do not reach the second container over the internet.
Do I miss something ?
Maybe i have to edit the second docker network?
I thougt, maybe the second docker network uses always the primary vnic?
I’m having a little trouble picturing what you have setup in Oracle. Why did you not use a reverse proxy and one host with both your containers(domains/websites).
When you say “but i only reach the first one per browser” do you mean, one site loads and the other just 404’s? Do you mean the same website loads on both URLs/IP’s?
I’d have to see some more info to better help, you but it sounds like you might not of exposed those ports properly, or maybe you had a mix up somewhere.
I just liked the idea of having one host for each project (domains).
I’m able to reach the website with domain1, but the connection to the website with domain2 just times out.
I double checked the forwarding from domain to IP and the port forwarding/exposing, but i use the same Ingress/Egress Rule-table for both hosts anyway.
I am able to connect via SSH (port 22) to IP2, that is why I think something is wrong with my docker/swag setup.
Oh! Awesome! Thanks for the link. This is One Instance with two public IPs attached to it? What do you mean when you say this:
Each host has an own public IP and an own private IP.
What are you referring to as each host here? The SWAG containers? When you say you SSH in on both IPs… are you not in the same machine when you do that?
Yes this is one instance, with two public IPs attached to it.
“Host” is maybe the wrong name, but i meant kind of a “virtual host”.
I know that i have only one machine with two IPs, but with the two VNICs (Virtual Network Interface Card) and the two IPs, I was able to use e.g. the 433 Port on boths IPs, that is why i labeld them as two “hosts”. So with host i mean the VNICs.
Sry I’m really bad at describing
Yes when I’m SSH in on both IPs, I’m on the same machine.
I use the exact same SecurityList (Ingress/Egress Rules) (the same file) for both VNICs/IPs.
I am able to reach IP1 through port 433 and 22 (SSH).
I am able to reach IP2 throught port 22 (SSH) but NOT 433.
That’s why I think I have a problem with my SWAG/docker Setup.
If i was not able to reach IP2 through port 22, i would know that something is wrong with the port forwarding, but that is not the case.
Ok. I think you’re issue is you can’t have two different things listening on 443. When you SSH in its the same exact thing, the SSH Server on your host. From what you’re describing you have two SWAG containers. One for each domain. Then you have this below:
ports:
- xx.x.x.xx:443:443
Which is different for each one? Am I correct? If so your 2nd SWAG probably isn’t going to start because the ports already used.
You don’t need to run two SWAG containers to accomplish this. You only need one with the EXTRA_DOMAINS flag.
This should help get you going in the right direction:
You don’t need to pass an IP on that port because you want it to listen on “any/everything”. So that will use the 0.0.0.0 IP which works better here. So I guess you could point your A record to either IP here if you wanted to.
Then I added the extra domains environment variable. Anyways, I hope this helps.
that is the thing, with two VNICs, with two VNICs you can use every port twice, one time for each IP.
That is why my second SWAG Container starts perfectly.
I read about the EXTRA_DOMAIN flag, but somebody in a blogpost said, that you should not use that anymore? But i think i just give it a try.
I want to run one Nextcloud-Container for each domain. That is not possible. Because i would need two nextcloud.subdomain.conf files unter config/nginx/proxy-conf.
But I can’t have two of these files with the same name.
Or is there another way ?
so i added a second Nextcloud and DB Container to my compose file,
added domain2 to EXTRA_DOMAIN and edited the second proxy-conf file for nextcloud and the config.php file for the second Nextcloud Container? Anything else i have to do?
My domain2 and nextcloud.domain2.com still redirects to my index page of domain1.
you need a second nextcloud.subdomain.conf file, the server_name for the second one should be changed from nextcloud.* to nextcloud.domain2.com and the server_name for the first one should be nextcloud.domain.com
Yeah as i wrote in my post before, I did all that and edited the server_name for both files.
At this point I think, maybe i should just use another server .
I also have a SSL for domain2.com, but not nextcloud.domain2.com.
I don’t want to right now, but am I right, when I say, that it would be not possible to create a normal website for domain2, because it still points on the website of domain2.
I dont follow what the issue is, previously you suggested you couldn’t do it because you can only have one nextcloud.subdomain.conf this is incorrect, just name it pooponastick.subdomain.conf or nextcloud2.subdomain.conf or purplenipples.subdomain.conf, the filename doesnt matter in any way as long as it ends in subdomain.conf
what you want to do is easily done and tons of ppl do it.
nextcloud.subdomain2.conf will not work. you cannot change the part that is subdomain.conf you can only change the name. so nextcloud1.subdomain.conf nextcloud2.subdomain.conf you can even do nc..subdomain.conf and nc..subdomain.conf as long as it ends with subdomain.conf
at this point, it might be best to visit our discord for more real-time support. we have a ton of experienced swag users online.