我在 Ubuntu 12.04 64 位上的 Amazon EC2 上运行带有 PHP5-FPM 的 Nginx。每次访问我的网站时,我都会收到网关错误。我知道这是一个配置问题,但我不确定配置错误是什么。
我的错误日志:
2012/11/17 05:29:19 [error] 9519#0: *4 open() "/var/www/growyourbutt.com/robots.txt" failed (2: No such file or directory), client: 131.253.41.146, server: growyourbut$
2012/11/17 05:29:19 [error] 9519#0: *5 open() "/var/www/growyourbutt.com/wp-content/themes/wp-bold107/images/facebook.png" failed (2: No such file or directory), clien$
2012/11/17 05:30:36 [error] 9519#0: *6 "/var/www/growyourbutt.com/tag/brazilian-butt-lift-surgery-cost/index.php" is not found (2: No such file or directory), client: $
2012/11/17 05:31:56 [error] 9519#0: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 67.85.186.145, server: growyourbutt.com, reques$
2012/11/17 05:31:56 [error] 9519#0: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 188.138.0.168, server: growyourbutt.com, reque$
2012/11/17 05:31:57 [error] 9519#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 188.138.0.168, server: growyourbutt.com, reque$
2012/11/17 05:32:00 [error] 9519#0: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 67.85.186.145, server: growyourbutt.com, reques$
2012/11/17 05:33:37 [error] 9519#0: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 67.85.186.145, server: growyourbutt.com, reque$
2012/11/17 05:33:44 [error] 9519#0: *18 connect() failed (111: Connection refused) while connecting to upstream, client: 67.85.186.145, server: growyourbutt.com, reque$
2012/11/17 05:33:44 [error] 9519#0: *18 open() "/var/www/growyourbutt.com/favicon.ico" failed (2: No such file or directory), client: 67.85.186.145, server: growyourbu$
2012/11/17 05:35:29 [error] 9519#0: *20 connect() failed (111: Connection refused) while connecting to upstream, client: 220.181.108.160, server: growyourbutt.com, req$
2012/11/17 05:35:45 [error] 9519#0: *22 connect() failed (111: Connection refused) while connecting to upstream, client: 123.125.71.111, server: growyourbutt.com, requ$
我的nginx.conf
:
ser www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
port_in_redirect off;
server_tokens off;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
port_in_redirect off;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascr$
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
如果有人能帮助我解决这个问题,我将不胜感激。
答案1
php-fpm 未运行。重新启动服务。
答案2
502错误的网关意味着你的 PHP5-FPM 即将消失,并且 NGINX 无法监听你的 php5-fpm。
检查 /var/log 上的 php5-fpm 应用程序的 error.log,解决错误,然后重新启动 php5-fpm