以下nginx.conf
会抛出一个常量502错误:
server {
listen 80;
server_name mydomain.com;
index index.php index.html index.htm;
set $root_path '/home/forge/mydomain.com/public';
root $root_path;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=$1;
}
location ~ \.php {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index /index.php;
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
}
我直接从Phalcon网站上得到了这个,但这引发了一个错误。我查看了我的服务器日志,我发现了这个错误:connect() to unix:/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstream
。我对Nginx的了解太少,无法确切知道这里出了什么问题。做你们中的任何一个吗?