CentOS Nginx+PHP-fpm下浏览器打开任何php页面都是file not found
nginx.conf配置文件如下:userwwwwww;##Default:nobodyworker_processes5;##Default:1error_loglog...
nginx.conf配置文件如下:
user www www; ## Default: nobody
worker_processes 5; ## Default: 1
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 80;
server_name 127.0.0.1;
root /var/www/;
index index.html index.htm index.php;
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
php-fpm.conf
; Set listen(2) backlog.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 128
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = www
;listen.group = www
;listen.mode = 0666
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
是不是哪儿出现问题了,另外php.ini要修改什么内容吗? 展开
user www www; ## Default: nobody
worker_processes 5; ## Default: 1
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 80;
server_name 127.0.0.1;
root /var/www/;
index index.html index.htm index.php;
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
php-fpm.conf
; Set listen(2) backlog.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 128
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = www
;listen.group = www
;listen.mode = 0666
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
是不是哪儿出现问题了,另外php.ini要修改什么内容吗? 展开
5个回答
展开全部
把你那个 $document_root 换成直接的 /var/www 试试呢
类似下面的
location ~\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/littlepig.cn/htdocs$fastcgi_script_name;
}
类似下面的
location ~\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/littlepig.cn/htdocs$fastcgi_script_name;
}
展开全部
location ~ \.php$ {
root html;
将root html;去掉
这段是重置该访问的文件根目录
你在server中已经定义了
root /var/www
root html;是Nginx安装目录下的html目录
是否是其他问题先改了这个才知道
root html;
将root html;去掉
这段是重置该访问的文件根目录
你在server中已经定义了
root /var/www
root html;是Nginx安装目录下的html目录
是否是其他问题先改了这个才知道
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
ps aux| grep nginx
ps aux| grep fpm
先排除 用户名 是否一致的问题,
别一个 是 www ,一个是 nobody
祝你好运!!!
ps aux| grep fpm
先排除 用户名 是否一致的问题,
别一个 是 www ,一个是 nobody
祝你好运!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
删掉
root html;
这行再试
root html;
这行再试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-04-22
展开全部
去掉注释
;listen.owner = www
;listen.group = www
;listen.owner = www
;listen.group = www
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询