linux centos 配置nginx 支持php-fpm

已安装nginx  php的情况下:
nginx -v
php -v
可以不用改nginx  php-fpm的user  group  使用默认的就好 主要是保证nginx  php-fpm都起来了
1、查看nginx:
    a、ps aux | grep nginx
      如果看到了nginx    27433  0.0  0.1 121192  3596 ?        S    14:31   0:00 nginx: worker process  类似的worker进程就证明起来了
    b、也可以查看: netstat -ant | grep LISTEN 看是否有80端口
2、查看php-fpm
    同上a、ps aux | grep php-fpm
       b、netstat -ant | grep LISTEN  看是否有9000端口  [mysql是3306]
修改nginx的配置文件 nginx.conf
如果不知道在哪 可以使用 whereis nginx.conf  或者 find / -name  nginx.conf 
yum安装的一般在/etc/nginx/nginx.conf
编译安装一般在/usr/local/nginx/nginx.conf

在nginx.conf中的第一个server{

    location / {
    root   html;
    index  index.php index.html index.htm;
}
    location ~* \.php$ {
    fastcgi_index   index.php;
    fastcgi_pass    127.0.0.1:9000;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}
}中添加括号中的代码
重启nginx   (kill -HUP nginx[这种表示杀死后自己启动] /  killall -9 nginx [这种是杀死还需要自己启动])
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值