Question
Configuring multiple domains and subdomains. DNS & Nginx issues abound!
What I’m shooting for:
- domain1.com > /home/user/www/domain1
- domain2.com > /home/user/www/domain2
- sub1.domain2.com > /home/user/www/sub1
- sub2.domain2.com > /home/user/www/sub2
- drop.let.ip.address > /home/user/www/domain1
What is happening:
- Navigating to drop.let.ip.address redirects to domain2
- Navigating to domain1 redirects to domain2
- Navigating to domain2 fails to resolve host
- Navigating to sub1 does not redirect, but fails to resolve host
- Navigating to sub2 does not redirect, but fails to resolve host
ZONE file for domain1:
$TTL 1800
@ IN SOA NS1.DIGITALOCEAN.COM. hostmaster.domain1.com. (
1414393689 ; last update: 2014-10-27 07:08:09 UTC
3600 ; refresh
900 ; retry
1209600 ; expire
1800 ; ttl
)
IN NS NS1.DIGITALOCEAN.COM.
NS NS2.DIGITALOCEAN.COM.
NS NS3.DIGITALOCEAN.COM.
@ IN A drop.let.ip.address
ZONE file for domain2:
$TTL 1800
@ IN SOA NS1.DIGITALOCEAN.COM. hostmaster.domain2.com. (
1414403298 ; last update: 2014-10-27 09:48:18 UTC
3600 ; refresh
900 ; retry
1209600 ; expire
1800 ; ttl
)
IN NS NS1.DIGITALOCEAN.COM.
NS NS2.DIGITALOCEAN.COM.
NS NS3.DIGITALOCEAN.COM.
@ IN A drop.let.ip.address
*.sub1 IN A drop.let.ip.address
*.sub2 IN A drop.let.ip.address
Server blocks for domain1:
server {
server_name domain1.com;
rewrite ^(.*) http://www.domain1.com$1 permanent;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/user/www/domain1;
index index.php index.html index.htm;
server_name www.domain1.com;
include hhvm.conf;
}
Server blocks for domain2:
server {
server_name domain2.com;
rewrite ^(.*) http://www.domain2.com$1 permanent;
}
server {
listen 80;
listen [::]:80;
root /home/user/www/sub1;
index index.html index.htm index.php;
server_name sub1.domain2.com;
include hhvm.conf;
}
server {
listen 80;
listen [::]:80;
root /home/user/www/sub2;
index index.html index.htm index.php;
server_name sub2.domain2.com;
include hhvm.conf;
}
server {
listen 80;
listen [::]:80;
root /home/sub/www/domain2;
index index.html index.htm index.php;
server_name www.domain2.com;
include hhvm.conf;
}
I’ve been pulling my hair out all day, and I’m pretty sure the reason it’s so hard to google is because it’s a simple DNS issue and I have no idea what i’m doing with DNS.
Any help would be greatly appreciated.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×