简体   繁体   English

不知道如何调试Nginx错误日志

[英]Don't know how to debug nginx error log

I'm having a problem configuring nginx. 我在配置Nginx时遇到问题。 When i put http://192.168.214.164 in web browser i get nginx An error occurred web page. 当我在网络浏览器中放置http://192.168.214.164时 ,我得到nginx网页发生错误。 Sorry, the page you are looking for is currently unavailable. 抱歉,您要查找的页面当前不可用。 Please try again later.... Faithfully yours, nginx. 请稍后再试...。忠实的,nginx。 Can someone please help me debug nginx-error.log file and help me configure server so it will work? 有人可以帮我调试nginx-error.log文件并帮助我配置服务器,以便它可以工作吗?

Regards 问候

This are my configuration files: 这是我的配置文件:
nginx.conf file nginx.conf文件

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 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 这是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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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