配置如下,路径改为对应的路径,端口改为对应的端口,php-fpm的cgi端口通常默认为9000,如有改动需对应调整:
server {
listen 8081;
server_name localhost;
access_log /正确日志路径/sucess.log;
error_log /错误日志路径/error.log;
root /项目路径;
index index.php index.htm index.html;
location / {
try_files $uri $uri/ /index.php;
}
location /index.php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /项目路径/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi.conf;
}
}