linux 配置nginx + php

nginx

通过yum安装以下依赖:

yum install gcc-c++
yum install openssl*
yum install pcre*
yum install zlib
yum install zlib-devel
yum install wget


# 我选择了一个相对较新的版本,下载到当前目录
wget http://nginx.org/download/nginx-1.13.9.tar.gz

# 解压
tar -xvf nginx-1.13.9.tar.gz

./configure --prefix=安装目录
make && make install

# 找到nginx.conf, sbin 启动, -s reload
find / -name '*nginx*
find / -name '*sbin*'

关闭CentOS7默认防火墙

// 启动firewall
systemctl start firewalld.service
// 停止firewall
systemctl stop firewalld.service
// 禁止firewall开机启动
systemctl disable firewalld.service


-------------------------
--------------------------------------------------

php
yum install php php-fpm  

启动php-fpm  
systemctl start php-fpm  
service php-fpm restart


nginx.conf 文件
开放php, 修改
location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi.conf;
}
 
 



猜你喜欢

转载自www.cnblogs.com/ignacio/p/11057491.html