当我尝试访问info.php我得到一个文件找不到.错误.
我试过一些教程没有用.
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寻找是错误的
/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上侦听. (编辑:甘南站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|