Nginx服务器未加载网站但正在运行

时间:2019-09-19 03:13:51

标签: nginx

我有一个现有的nginx ubuntu Web服务器,但是由于某些原因,网站不再加载。

我做了一个:sudo netstat -plutn | grep nginx

并且nginx正在运行:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      28000/nginx -g daem
tcp        0      0 139.xxx.xx.xx:443       0.0.0.0:*               LISTEN      28000/nginx -g daem
tcp6       0      0 :::80                   :::*                    LISTEN      28000/nginx -g daem

(在端口443上屏蔽了我的IP)

这是其所服务网站的conf文件

server {
    listen 80;
    #listen [::]:80;

    server_name domain.com www.domain.com;

    root /var/www/html/domain.com/public_html;
    index index.php index.html;

    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                include fastcgi_params;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_param SCRIPT_FILENAME /var/www/html/domain.com/public_html$fastcgi_script_name;
        }
}

,当我浏览错误日志或访问日志时,没有错误。在浏览器上查看该网站后,我会发现连接超时。是因为我在端口80上的IP是0.0.0.0吗?我如何将其设置为使用我的IP 139.x.x.x?谢谢!道歉仍然是nginx上服务器设置的新手。

2 个答案:

答案 0 :(得分:0)

也许您需要在ubuntu服务器中打开443/80端口。有关更多信息:How to open port 443 in ubuntu

答案 1 :(得分:0)

尝试注释掉配置中的所有内容。仅保留以下服务器节:

server {
    server_name domain.com www.domain.com;

    return 200 "it works
";
}

如果可行,请重新添加内容。

p.s。我会把它放在评论中,但是这里的格式更好