php fpm not found,nginx + php-fpm碰到File not found

# 源码安装的nginx,目录/application/nginx-1.8.1

useradd coosh

su - coosh

# 以下为nginx.conf配置文件的内容,注意该文件是放在coosh的家目录下

# 由于该配置文件不是在nginx安装目录中,所以里面的目录路径要全换成绝对路径

cat >nginx.conf <

worker_processes  1;

error_log /home/coosh/error.log;

pid       /home/coosh/nginx.pid;

events {

worker_connections  1024;

}

http {

include       /application/nginx-1.8.1/conf/mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

gzip on;

gzip_types text/css text/xml text/plain application/javascript;

gzip_min_length 1k;

gzip_comp_level 5;

gzip_vary on;

server {

listen          8080;

access_log      off;

# 我的网站目录是在家目录下的website目录中

root    /home/coosh/website;

location / {

root    /home/coosh/website;

index   index.php;

}

location ~ \.php$ {

#由于9000端口已经被另一个php-fpm占用了,所以另起了一个9001

fastcgi_pass   127.0.0.1:9001;

fastcgi_index  index.php;

#这里的$document_root取值是server块里的root

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        /application/nginx-1.8.1/conf/fastcgi.conf;

}

}

}

EOF

#测试一下该配置文件

/application/nginx/sbin/nginx -c /home/coosh/nginx.conf -t

#通常会提示没有权限访问/application/nginx-1.8.1/logs/error.log,这确实很奇怪,因为在配置文件里命名是配了error_log参数,但仍提示这个路径,解决的方法是用root给这个文件配上所有人可读写。

logout

chmod 666 /application/nginx-1.8.1/logs/error.log

# 回到coosh用户下

su - coosh

/application/nginx/sbin/nginx -c /home/coosh/nginx.conf -t

# 如无意外,会提示OK和successful

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值