I have hosted two wordpress websites on single droplet and trying to host another one which is xyz.com but the problem is that when I open xyz.com it redirects to my default server domain name abc.com please help me in this, I am stuck from 2 days. DNS setting: A record @ 198.xxx.xxx.xxx CNAME:www xyz.com. CNAME:* xyz.com. ns:ns1.digitalocean.com. ns:ns2.digitalocean.com. ns:ns2.digitalocean.com.
Server Block:
server { listen 80; listen [::]:80;
root /var/www/xyz.com/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name xyz.com www.xyz.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
thanks
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.
Hi…We are also facing similar issue…Hosted two sites, the second one is always getting redirected to the first one…The details follows:
A record for both domains: @ IP Number
CNAME for both domains: *domain name.
Server block for first domain: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;
root /var/www/first-site.in/html; index index.php index.html index.htm;
server_name first-site.in www.first-site.in;
Server block for second domain: server { listen 80; listen [::]:80;
root /var/www/second-site.net/html; index index.php index.html index.htm;
server_name second-site.net www.second-site.net;
Please tell us, how this issue can be solved…Thanks and Regards…
If you get a chance to post your server block for the second site that may reveal the issue - please update when you’re able.
Can you please post the server block to abc.com. I see that you have two Cname records, where are they pointed to?