我试过一些教程没有用.
CONFIGS:
默认:
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name localhost;
location / {
root /var/www;
index index.html index.htm index.PHP;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.PHP${
fastcgi_pass 127.0.0.1:7777;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME /usr/share/Nginx/html$fastcgi_script_name;
fastcgi_buffers 256 128k;
#fastcgi_buffer_size 16k;
#fastcgi_busy_buffers_size 256k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include fastcgi_params;
}
}
有什么问题?
最佳答案
如果那个info.PHP在/ var / www中,那么指示fast_cgi寻找是错误的
原文链接:https://www.f2er.com/nginx/434680.html/usr/share/Nginx/html/info.PHP;
对于html和PHP使用相同的根.此外,根和索引参数应该在特定位置之外,除非非常具体的用途.
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name localhost;
root /var/www;
index index.html index.htm index.PHP;
#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.PHP${
fastcgi_pass 127.0.0.1:7777;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 256 128k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include fastcgi_params;
}
}
不用说,您仍然需要确保您的PHP-fpm服务正在7777端口上侦听.通常的情况是让它在端口9000上侦听.