My nginx configuration does not serve any page when it is accessed from localhost. For example: When I access the site externaly via it's url (let's say example.com) it happily serves the page. When I run 'curl localhost' from the server that is running nginx itself, it responds with 404 Not Found.
This is the nginx site config:
server {
listen *:80 default_server;
server_name localhost;
access_log /var/log/nginx/phpmyadmin_access.log;
error_log /var/log/nginx/phpmyadmin_error.log;
# Main application:
location / {
root /var/www/example.com/;
index index.php index.html index.htm;
}
}
(please note that i replaced my url with 'example.com' for privacy reasons)
The site currently only contains a hello world text, that is happily served when running 'curl example.com':
example@example.com:/etc/nginx/sites-enabled$ curl example.com
Hello World!!!
But when I run 'curl localhost' i only get:
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
Thanks for helping.