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

  • 相关阅读:
    ACM ICPC 2008–2009 NEERC MSC A, B, C, G, L
    POJ 1088 滑雪 DP
    UVA 11584 最短回文串划分 DP
    POJ 2531 Network Saboteur DFS+剪枝
    UVa 10739 String to Palindrome 字符串dp
    UVa 11151 Longest Palindrome 字符串dp
    UVa 10154 Weights and Measures dp 降维
    UVa 10271 Chopsticks dp
    UVa 10617 Again Palindrome 字符串dp
    UVa 10651 Pebble Solitaire 状态压缩 dp
  • 原文地址:https://www.cnblogs.com/hltswd/p/6971281.html
Copyright © 2011-2022 走看看