当我尝试访问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上侦听.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。