Mobile app version of vmapp.org
Login or Join
Sarah324

: Default server name nginx A server is hosting several website each having its own domain name. Nginx is used the reverse proxy. When a domain name is pointing to the IP of the server and

@Sarah324

Posted in: #Configuration #Nginx

A server is hosting several website each having its own domain name. Nginx is used the reverse proxy.

When a domain name is pointing to the IP of the server and that no server_name is specified nginx serves a default one that matches with the first configuration file.

I want to avoid this behavior and set on my own the default website nginx should serve.

How can I do this? How can a _default server_name server be chosen when the domain name requested is non-existent.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sarah324

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

Add the default_server keyword to the listen directive.

server {
listen 80 default_server;
...
}


See this document for more information.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme