码迷,mamicode.com
首页 > Web开发 > 详细

centos下配置nginx支持php

时间:2016-07-09 16:14:03      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:

添加nginx 默认主页index.php 

vim /etc/nginx/conf.d/default.conf 

 

location / {

        root   /usr/share/nginx/html;

        index  index.html index.htm index.php;

    }

 

配置nginx支持php

vim /etc/nginx/conf.d/default.conf 

 

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    #

    location ~ .php$ {

        root           html;

        fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;

        include        fastcgi_params;

    }

 

配置php-fpm

vim /etc/php-fpm.d/www.conf

 

; Unix user/group of processes

; Note: The user is mandatory. If the group is not set, the default user‘s group

;       will be used.

; RPM: apache Choosed to be able to access some dir as httpd

user = nginx

; RPM: Keep a group allowed to write in log dir.

group = nginx

 

chkconfig php-fpm on    #设置php-fpm自启动

chkconfig mysqld on     #设置mysqld自启动

service nginx restart   #重新启动nginx

service php-fpm start   #启动php-fpm

service mysqld start    #启动mysqld

 

centos下配置nginx支持php

标签:

原文地址:http://www.cnblogs.com/sign-ptk/p/5655896.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!