我的 ubuntu nginx 服务器的这个配置文件出现了 502 Bad gateway 错误,有人能看出这有什么问题吗?我对 Linux 还很陌生,所以任何建议都会有帮助。我正在尝试使用 Learning Locker,但遇到了此部分的问题。
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_serve
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
# Useful logs for debug.
access_log /var/www/learninglocker/access.log;
error_log /var/www/learninglocker/error.log;
rewrite_log on;
# The location of our projects public directory.
root /var/www/learninglocker/public;
# Point index to the Laravel front controller.
index index.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
# PHP FPM configuration.
location ~* \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# We don't need .ht files with nginx.
location ~ /\.ht {
deny all;
}
# Set header expirations on per-project basis
location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
expires 365d;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
错误日志指出:-
2015/05/27 11:20:53 [错误] 23518#0: *1 recv() 失败(104:对等方重置连接)从上游读取响应标头时,客户端:11.11.23.23,服务器:_,请求:“GET / HTTP/1.1”,上游:“fastcgi://unix:/var/run/php5-fpm.sock:”,主机:“learninglocker.sourcecodingltd.co.uk”