0
I have a server running nginx for a couple WordPress sites. My existing sites work fine but I'm trying to add another site right now and the new domain I'm setting up is redirecting to another site. I don't have a default host it's going to the domain that's alphabetically first on the server which my understanding is nginx behaviour when it doesn't have a match for the domain coming in.
So here's my config for the new domain:
server {
listen 80;
server_name domain.com.au www.domain.com.au;
root /var/www/domain.com.au/html;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?args;
}
location ~\.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
1Have you checked if your nginx config file is valid?
sudo nginx -t
– sudo – 2019-08-27T06:07:45.927Also, use
nginx -T
(uppercaseT
) to view the entire configuration that Nginx is reading. – Richard Smith – 2019-08-27T06:17:49.393yeah says syntax ok test is successful – benikens – 2019-08-27T06:23:56.257
Could be a DNS problem, can you try using
dig domain.com.au
anddig www.domain.com.au
and see if it resolves to your server IP. – sudo – 2019-08-27T06:27:08.183I got an IP address I don't recognise 104.24.111.246 I'm seeing a website on the same server though when I type in the domain so it seems to me like nginx must be the issue – benikens – 2019-08-28T05:39:27.390
I'm dumb was a typeo in the folder name – benikens – 2019-09-01T09:03:18.503