nginx directing domain to wrong site

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;
    }
}

benikens

Posted 2019-08-27T02:02:47.013

Reputation: 1

1Have you checked if your nginx config file is valid? sudo nginx -t – sudo – 2019-08-27T06:07:45.927

Also, use nginx -T (uppercase T) to view the entire configuration that Nginx is reading. – Richard Smith – 2019-08-27T06:17:49.393

yeah 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 and dig www.domain.com.au and see if it resolves to your server IP. – sudo – 2019-08-27T06:27:08.183

I 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

No answers