Freshly installed nginx not serving default page

2019-08-09 08:44发布

问题:

I just installed nginx on a new ubuntu instance. It looks like nginx is running, here are the processes:

root      2062  0.0  0.1  85868  1340 ?        Ss   01:13   0:00 nginx: master process /usr/sbin/nginx
www-data  2063  0.0  0.1  86212  1768 ?        S    01:13   0:00 nginx: worker process
www-data  2064  0.0  0.1  86212  1768 ?        S    01:13   0:00 nginx: worker process
www-data  2065  0.0  0.1  86212  1768 ?        S    01:13   0:00 nginx: worker process
www-data  2066  0.0  0.1  86212  1768 ?        S    01:13   0:00 nginx: worker process
ubuntu    2120  0.0  0.0  10460   932 pts/0    S+   01:34   0:00 grep --color=auto nginx

Also here is sudo nstat -plnt

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1076/sshd       
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2062/nginx      
tcp6       0      0 :::22                   :::*                    LISTEN      1076/sshd       
tcp6       0      0 :::80                   :::*                    LISTEN      2062/nginx  

But when I go to my public ip address (I don't have any sites configured) my browser times out and the default nginx page is not displayed.

There are no errors in the nginx log and sudo nginx -t looks fine. I followed some tuts to get it installed and started, but everyhthing says it should immediately serve the default homepage.

Here is what is in my /etc/nginx/sites-enabled

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;

    location / {
            try_files $uri $uri/ =404;
    }
}
标签: ubuntu nginx