# I can't get nginx online



## cenu (Jan 15, 2014)

I need help setting up my nginx server. nginx has no problem serving LOCAL requests. But whenever I try to send requests from ELSEWHERE, it gives an error 504 message. Setting up SSH was not NEARLY this confusing. Please help.


----------



## ShelLuser (Jan 15, 2014)

You might want to start checking the Nginx logfiles, those should give you a clue as to what is going on. In general, a 504 error usually indicates a problem with a gateway of some sort. See for example this article.


----------



## nanotek (Jan 15, 2014)

cenu said:
			
		

> I need help setting up my nginx server. nginx has no problem serving LOCAL requests.
> 
> But whenever I try to send requests from ELSEWHERE, it gives an error 504 message.
> 
> ...



Hi.

Please post your nginx.conf (plus any additional Nginx configuration files) and the log entries made when receiving your 504s in response to URI requests.


----------



## cenu (Jan 15, 2014)

```
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  15;

    #gzip  on;

    server {
        listen       80;
        server_name  cenu.net www.cenu.net;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /data/www;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /data/www;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
```
nginx.conf:


```
127.0.0.1 - - [14/Jan/2014:22:45:50 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:22:45:50 +0000] "GET /favicon.ico HTTP/1.1" 404 570 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
192.168.0.5 - - [14/Jan/2014:22:48:03 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
192.168.0.5 - - [14/Jan/2014:22:48:04 +0000] "GET /favicon.ico HTTP/1.1" 404 570 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
70.173.243.223 - - [14/Jan/2014:22:48:16 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
70.173.243.223 - - [14/Jan/2014:22:48:17 +0000] "GET /favicon.ico HTTP/1.1" 404 570 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:22:52:31 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:22:52:31 +0000] "GET /favicon.ico HTTP/1.1" 404 570 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:14:32 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:14:32 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:19:33 +0000] "GET / HTTP/1.1" 200 606 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:20:04 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:25:12 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:25:14 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
70.173.243.223 - - [14/Jan/2014:23:26:38 +0000] "GET / HTTP/1.1" 200 612 "http://toolbar.netcraft.com/site_report?url=http://70.173.243.223" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
70.173.243.223 - - [14/Jan/2014:23:26:38 +0000] "GET /favicon.ico HTTP/1.1" 404 570 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
127.0.0.1 - - [14/Jan/2014:23:57:27 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36"
```
nginx-acces.log


```
2014/01/14 22:45:50 [error] 1361#0: *1 open() "/usr/local/www/nginx/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2014/01/14 22:48:04 [error] 1361#0: *2 open() "/usr/local/www/nginx/favicon.ico" failed (2: No such file or directory), client: 192.168.0.5, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.7"
2014/01/14 22:48:17 [error] 1361#0: *4 open() "/usr/local/www/nginx/favicon.ico" failed (2: No such file or directory), client: 70.173.243.223, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "70.173.243.223"
2014/01/14 22:52:31 [error] 1361#0: *5 open() "/usr/local/www/nginx/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2014/01/14 23:07:47 [notice] 1740#0: signal process started
2014/01/14 23:12:18 [notice] 1761#0: signal process started
2014/01/14 23:24:54 [notice] 1808#0: signal process started
2014/01/14 23:26:38 [error] 1809#0: *9 open() "/data/www/favicon.ico" failed (2: No such file or directory), client: 70.173.243.223, server: cenu.net, request: "GET /favicon.ico HTTP/1.1", host: "70.173.243.223"
2014/01/14 23:57:16 [notice] 1920#0: signal process started
2014/01/15 00:18:45 [notice] 1977#0: signal process started
```
nginx-error.log


----------



## nanotek (Jan 16, 2014)

I thought you might have a Fast CGI timeout issue but you're not even passing PHP. Your configuration is stock so I'm guessing the problem is peripheral to Nginx, but I'm not qualified to provide a diagnosis. Hopefully some of the network gurus will chime in.


----------



## Jeckt (Jan 16, 2014)

This may be an issue depending on how the "Host" sent by the browser. Try removing the server_name directive, or setting it to the IP address and accessing it that way. Also see if the default_server option on the listen port helps catch the request.


----------



## junovitch@ (Jan 17, 2014)

Jeckt said:
			
		

> This may be an issue depending on how the "Host" sent by the browser. Try removing the server_name directive, or setting it to the IP address and accessing it that way. Also see if the default_server option on the listen port helps catch the request.



In this case, it will use the first server block anyways.  Since there is one, this won't make a difference.

What does `ls -l /data/www/index.html` return?  Is this readable by the www user?  The other messages in your error log are for favicon.ico are just the browser getting the little favorite's icon to use in a bookmark or your history.  It doesn't mean much.


----------



## SirDice (Jan 17, 2014)

I may be going blind of old age but I don't see any 504 errors in the logs. Are you sure you're looking for the right thing?


----------



## nesstyy (Jan 19, 2014)

Do you have favicon.ico on nginx ?

```
location / {
            root   /data/www;
            index  index.html index.htm;
        }
```
You only have errors about favicon. Check if you have favicon.ico in ../usr/local/www/nginx/favicon.ico.


----------



## cenu (Feb 4, 2014)

Okay, I found out that it's a problem with my ISP.
They're blocking all external HTTP requests to my server...  x(


----------

