Valor_
Valor_

Reputation: 3601

Don't know how to debug nginx error log

I'm having a problem configuring nginx. When i put http://192.168.214.164 in web browser i get nginx An error occurred web page. Sorry, the page you are looking for is currently unavailable. Please try again later.... Faithfully yours, nginx. Can someone please help me debug nginx-error.log file and help me configure server so it will work?

Regards

This are my configuration files:
nginx.conf file

user nginx;
worker_processes  auto;
error_log       /var/log/nginx/nginx-error.log debug;
pid        /var/run/nginx.pid;

events {
   use epoll;
}

http {

    include       /etc/nginx/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"
                      cache: $upstream_cache_status '
                      'upstream: $upstream_addr in $upstream_response_time sec';

    access_log /var/log/nginx/nginx-access.log main;

    sendfile        on;
    #keepalive_timeout  65;

    include /etc/nginx/conf.d/webportal.conf;

    }

webportal.conf

server {

    listen 192.168.214.164:80;

    charset utf-8;
    access_log /var/log/bswp_log/bswp.access.log;
    error_log /var/log/bswp_log/bswp.error.log error;

    root   /var/www/html/bswp.tv/browser;
    index  index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
        location ~ \.php$ {
                root           /var/www/html/bswp.tv/browser;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_intercept_errors on;
                fastcgi_index  index.php;
                fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include         fastcgi_params;
              }

        location /upload/ {
                try_files $uri @dynImage;
                rewrite_log on;
        }
    }

    location @dynImage {
         rewrite (([^/]+)\.(jpe?g|png))(\?(\d))?&?(random=\d+?)?$ /image_loader.php?file=$1&$query_string;
    }

    #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   /usr/share/nginx/html;
    }

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

This is nginx-error.log

2015/02/16 11:00:50 [notice] 1766#0: signal 17 (SIGCHLD) received
2015/02/16 11:00:50 [notice] 1766#0: worker process 1768 exited with code 0
2015/02/16 11:00:50 [notice] 1766#0: exit
2015/02/16 11:02:33 [notice] 1837#0: using the "epoll" event method
2015/02/16 11:02:33 [notice] 1837#0: nginx/1.6.2
2015/02/16 11:02:33 [notice] 1837#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
2015/02/16 11:02:33 [notice] 1837#0: OS: Linux 2.6.32-504.8.1.el6.x86_64
2015/02/16 11:02:33 [notice] 1837#0: getrlimit(RLIMIT_NOFILE): 1024:4096
2015/02/16 11:02:33 [notice] 1838#0: start worker processes
2015/02/16 11:02:33 [notice] 1838#0: start worker process 1840
2015/02/16 11:04:06 [notice] 1838#0: signal 15 (SIGTERM) received, exiting
2015/02/16 11:04:06 [notice] 1840#0: exiting
2015/02/16 11:04:06 [notice] 1840#0: exit
2015/02/16 11:04:06 [notice] 1838#0: signal 17 (SIGCHLD) received
2015/02/16 11:04:06 [notice] 1838#0: worker process 1840 exited with code 0
2015/02/16 11:04:06 [notice] 1838#0: exit
2015/02/16 11:04:07 [notice] 1860#0: using the "epoll" event method
2015/02/16 11:04:07 [notice] 1860#0: nginx/1.6.2
2015/02/16 11:04:07 [notice] 1860#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
2015/02/16 11:04:07 [notice] 1860#0: OS: Linux 2.6.32-504.8.1.el6.x86_64
2015/02/16 11:04:07 [notice] 1860#0: getrlimit(RLIMIT_NOFILE): 1024:4096
2015/02/16 11:04:07 [notice] 1861#0: start worker processes
2015/02/16 11:04:07 [notice] 1861#0: start worker process 1863
2015/02/16 11:38:59 [notice] 1861#0: signal 15 (SIGTERM) received, exiting
2015/02/16 11:38:59 [notice] 1863#0: exiting
2015/02/16 11:38:59 [notice] 1863#0: exit
2015/02/16 11:38:59 [notice] 1861#0: signal 17 (SIGCHLD) received
2015/02/16 11:38:59 [notice] 1861#0: worker process 1863 exited with code 0
2015/02/16 11:38:59 [notice] 1861#0: exit
2015/02/16 11:38:59 [notice] 1945#0: using the "epoll" event method
2015/02/16 11:38:59 [notice] 1945#0: nginx/1.6.2
2015/02/16 11:38:59 [notice] 1945#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
2015/02/16 11:38:59 [notice] 1945#0: OS: Linux 2.6.32-504.8.1.el6.x86_64
2015/02/16 11:38:59 [notice] 1945#0: getrlimit(RLIMIT_NOFILE): 1024:4096
2015/02/16 11:38:59 [notice] 1946#0: start worker processes
2015/02/16 11:38:59 [notice] 1946#0: start worker process 1948
2015/02/16 11:42:35 [notice] 1946#0: signal 15 (SIGTERM) received, exiting
2015/02/16 11:42:35 [notice] 1948#0: exiting
2015/02/16 11:42:35 [notice] 1948#0: exit
2015/02/16 11:42:35 [notice] 1946#0: signal 17 (SIGCHLD) received
2015/02/16 11:42:35 [notice] 1946#0: worker process 1948 exited with code 0

Upvotes: 0

Views: 2807

Answers (1)

David Parlevliet
David Parlevliet

Reputation: 502

turn fastcgi_intercept_errors off -- your PHP code is most likely erroring and nginx is intercepting it and returning an error page http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_intercept_errors

Upvotes: 2

Related Questions