centos下配置nginx支持php
安装php
yum install php yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc |
添加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
上一篇: cmd dos启动和关闭应用程序
推荐阅读
-
Windows7下PHP开发环境安装配置图文方法
-
在CentOS上配置Nginx+Gunicorn+Python+Flask环境的教程
-
CentOS7下如何配置ip forward(虚拟路由器)
-
CentOS7下mysql 8.0.16 安装配置方法图文教程
-
Centos7下mysql 8.0.15 安装配置图文教程
-
IIS下配置Php+Mysql+zend的图文教程(完整版)
-
在Mac OS的PHP环境下安装配置MemCache的全过程解析
-
CentOS7下MySQL5.7安装配置方法图文教程(YUM)
-
windows下配置apache+php+mysql时出现问题的处理方法
-
在阿里云服务器上配置CentOS+Nginx+Python+Flask环境