简体   繁体   中英

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

关闭fastcgi_intercept_errors您的PHP代码很可能出错,nginx正在拦截它并返回错误页面http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_intercept_errors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM