Centos配置nginx+php

2018-02-03 10:33:51来源:oschina作者:姿势喵人点击

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

添加nginx 默认主页index.php


location / {
root /usr/share/nginx/html;
index index.html index.htm index.php;
}

配置nginx支持php


# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$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自启动


service nginx restart #重新启动nginx


service php-fpm start #启动php-fpm

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台