微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

centos下配置nginx支持php

安装PHP

添加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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。