Nginx默认页面未显示在浏览器中

Kum*_*koo 5 bash ubuntu nginx

我是nginx的新手。我的问题是即使nginx似乎正在运行,默认页面也不会显示在浏览器中。

我的环境是Windows上的bash ubuntu。我已经成功安装了带有realip模块的nginx,至少这是安装完成时所说的。

开始,sudo service nginx start 我在任务管理器中检查了nginx是否正在运行。我sudo netstat -plunt在bash上运行,它显示以下内容

/etc$ sudo netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
Run Code Online (Sandbox Code Playgroud)

还做了以下

/etc$ ps waux |grep nginx
root       164  0.0  0.0      0     0 ?        Ss    2433   0:00 nginx: master pr
babbbsa+   171  0.0  0.0      0     0 ?        S     2433   0:00 grep --color=auto nginx
Run Code Online (Sandbox Code Playgroud)

etc/nginx/sites-enabled/default正确的默认配置包括所有相关配置,除了我用[::]:80以下建议注释了该行,以解决使用端口80已在使用中的消息而导致nginx运行失败的消息。即:(nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use))

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

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

        # Make site accessible from http://localhost/
        server_name localhost;
Run Code Online (Sandbox Code Playgroud)

在ubuntu上运行nginx之后,我打开浏览器以使用localhost查看默认页面。确切地说,我使用了以下内容:

      http://localhost/
      also tried it with:
      http://localhost:80
      http://x.x.x.x    # where x.x.x.x is my IPv4adress
      http://x.x.x.x:80    # where x.x.x.x is my IPv4adress
Run Code Online (Sandbox Code Playgroud)

在所有情况下,都不会显示错误页面或默认的nginx欢迎页面。只是该页面waiting for localhost ... 在状态栏上挂有消息。

我已经访问了 刚安装的nginx不提供默认页面的页面,也访问了 https://serverfault.com/questions/726546/what-are-the-first-steps-to-debug-nginx-default-page-not-showing-on -fresh-ubuntu,但是给出的解决方案无法解决我的问题。在这里,在EC2实例上运行nginx遇到麻烦,讨论了该问题可能与安全策略设置不正确有关。为了解决这个问题,建议" ... go into 'the' security groups and make one that has port 22 open, port 80 open, and port 443 open (HTTPS) .."如果这是我的问题的解决方案(不是说我不在运行nginx -on -ec2实例,而是为了以防万一,如果问题是安全性,那么我提到这一点是为了表明我也已经看到了这一点)如何设置安全性组并打开端口?请注意,我正在Windows bash ubuntu上工作,如果有人知道我的问题的解决方案,请明确说明如何解决该问题。谢谢!