This is my localhost server configuration for Nginx. This is at /etc/nginx/sites-enabled/development/localhost
server {
listen 80 default_server;
server_name localhost;
root /var/www/html;
index index.nginx-debian.html;
location / {
internal;
}
error_page 404 /404.html;
location /404.html {
root /var/www/html/errors;
internal;
}
}
If I call http://locahost
in URL bar, a 404 page error is shown. But should show index.nginx-debian.html
. But if I call http://localhost
with a valid subdomain, it works. Like that http://users.localhost
, defined in /etc/nginx/sites-enabled/development/users
.
I want to show Nginx default page if I only call http://localhost
, 404.html
if subdomain doesn’t exist, and another any page if I call http://localhost
correctly with a defined subdomain.