Knide
Knide

Reputation: 131

Nginx server not loading website but it is running

I have an existing nginx ubuntu web server but for some reason the websites are no longer loading.

I did a: sudo netstat -plutn | grep nginx

and nginx is running:

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

(masked my ip on port 443)

This is the conf file for the website it is serving

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;
        }
}

and when I browse the error log or access logs there are no errors. The site when viewed on the browser would return me a connection timed out. Is it because my IP on port 80 is 0.0.0.0? how can I set it to use my ip 139.x.x.x ?? thank you! Apologies still a newbie on server setup on nginx.

Upvotes: 2

Views: 11539

Answers (2)

Cole Tierney
Cole Tierney

Reputation: 10304

Try commenting out everything in your config. Leave just the following server stanza:

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

    return 200 "it works
";
}

If that works, start adding things back in.

p.s. I would've dropped this in as comment, but the formatting is better here

Upvotes: 2

Michael
Michael

Reputation: 189

Maybe you need to open the 443/80 port in your ubuntu server. For more: How to open port 443 in ubuntu.

Upvotes: 2

Related Questions