I have a few questions about this configuration file "default" in /etc/nginx/sites-enabled. It is shown below.
server
{
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8080;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex off;
}
}
- There is no "Listen" directive, how does it know to default to 80
- The server_name is localhost, how does another domain work?
- Why is the location directive embedded in the server directive? Does that mean these locations ONLY apply to this server?
- None of my configs have listen 80 default_server; how does nginx then pick what configuration to use?