zoukankan      html  css  js  c++  java
  • centos6下nginx配置php可用

    先查看下所有服务的状态,看看php-fpm有没有正在运行

    [root@centos64 html]# service --status-all

    php-fpm (pid  3568) 正在运行...

    如果php-fpm已停,就开启此服务:service php-fpm start

    如果php-fpm已死或没有,就先卸载当前的php和httpd,然后再重新安装php

    # yum remove httpd* php* 

    重新安装php

    默认情况下,CentOS的官方资源是没有php-fpm的, 但我们可以从Remi的RPM资源中获得,它依赖于EPEL资源。我们可以这样增加两个资源库:

    # yum install yum-priorities -y  

    # rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm  

    # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm  

    安装php

    [root@centos64 html]# yum --enablerepo=remi install php php-fpm  

    安装完成之后再看看服务状态应该就有了,service --status-all,启动php-fpm服务

    最后就是修改nginx.conf配置文件了

    [root@centos64 html]# vi /var/nginx/conf/nginx.conf

    location ~ .php$ {
    root html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /var/nginx/html$fastcgi_script_name;
    include fastcgi_params;
    }

    找到这段代码,原先是注释掉的,打开它,然后把红色部分修改成项目web根目录(原先是/scripts)

    重启nginx就可以了,测试ok

    [root@centos64 html]# /var/nginx/sbin/nginx -s reload

  • 相关阅读:
    CF627A Xor Equation
    CF865C Gotta Go Fast
    HDU 2222 Keywords Search
    BZOJ 2038: [2009国家集训队]小Z的袜子(hose)
    BZOJ 3781: 小B的询问
    BZOJ 1086: [SCOI2005]王室联邦
    BZOJ 2120: 数颜色
    BZOJ 1503: [NOI2004]郁闷的出纳员
    BZOJ 3757: 苹果树
    BZOJ 1861: [Zjoi2006]Book 书架
  • 原文地址:https://www.cnblogs.com/hltswd/p/6971281.html
Copyright © 2011-2022 走看看