Nginx serving wrong site
James Read
jamesread5737 at gmail.com
Mon Jan 8 16:34:37 UTC 2024
On Mon, 8 Jan 2024, 10:04 Francis Daly, <francis at daoine.org> wrote:
> On Mon, Jan 08, 2024 at 09:49:23AM -0500, James Read wrote:
> > On Mon, 8 Jan 2024, 09:29 Francis Daly, <francis at daoine.org> wrote:
> > > On Mon, Jan 08, 2024 at 09:13:38AM -0500, James Read wrote:
>
> Hi there,
>
> > > So I'm going to guess that your "server_name" line is of the
> > > form "www.example.com"; and your browser is instead accessing
> > > http://example.com; and nginx is returning the content of the
> > > default_server for that ip:port instead of this server.
> >
> > My server_name is of the form "example.com www.example.com;" so I don't
> > think that is the problem. Could this be anything to do with dns
> > configuration?
>
> Do your nginx logs indicate that the request is being handled by this
> nginx instance at all?
>
> If not, maybe DNS is not causing your browser to talk to this server's
> IP address.
>
> The logs look fine. They are showing the requests.
>
>
> Do you have any "listen" directives that include specific IP addresses,
> instead of just ports? Does your example.com resolve to the address
> of the "listen" in this "server{}"; or to the address of the "listen"
> in whichever "server{}" is actually being used; or to a different address?
>
server {
listen 80;
listen [::]:80;
root /var/www/moshiim.it;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
> Cheers,
>
> f
> --
> Francis Daly francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20240108/09679bb5/attachment-0001.htm>
More information about the nginx
mailing list