Nginx 站点配置ThinkPHP5.1时,报错PHP-FPM connect() to unix:/tmp/php5-fpm.sock failed (2: No such file or directory)解决办法
更改/etc/php/5.6/fpm/pool.d/www.conf文件
sudo vim /etc/php/5.6/fpm/pool.d/www.conf
##更改第38行
listen = 127.0.0.1:9000;
站点配置文件
更改fastcgi_pass
fastcgi_pass 127.0.0.1:9000;
详细的站点配置文件如下
server
{
listen 80;
server_name thinkphp.com;
index index.html index.htm index.php;
root /home/cygk-1.0/public;
# 禁止读取 svn 文件
location ~ ^(.*)\/\.svn\/
{
return 404;
}
# 禁止允许 .php 文件
location ~ \.php
{
return 444;
}
# 允许访问静态资源
location ~ (/static/)|(favicon\.ico$)
{
try_files $uri =404;
}
location /
{
# try_files $uri /index.php?$query_string;
rewrite ^/(.*)$ /index.php?s=/$1;
location = /index.php
{
# 开启 PATH_INFO
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}