我在配置nginx时遇到问题。 当我将http://192.168.214.164放入网络浏览器时,我得到nginx网页出错了。抱歉,您要查找的页面目前无法使用。请稍后再试....忠实于你,nginx。 有人可以帮我调试nginx-error.log文件并帮我配置服务器以便它可以工作吗?
此致
这是我的配置文件:
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
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;
}
}
这是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
答案 0 :(得分:1)
关闭fastcgi_intercept_errors
- 您的PHP代码很可能出错,nginx正在拦截它并返回错误页面http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_intercept_errors