CentOS 7.9 nginx/php7

 1. 安装nginx
 yum install nginx 
 nginx -v
     nginx version: nginx/1.20.1


 vi /etc/nginx/nginx.conf
     error_log /var/log/nginx/error.log;
     access_log  /var/log/nginx/access.log  main;
 
     server
root         /usr/share/nginx/html;
 

 ps -ef | grep nginx   可以看到nginx的进程

这时可以web访问网站了,但不支持php文件。

2.  安装PHP7.0.33

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 yum install php70w

 yum install php70w-fpm

修改nginx.conf  增加:

location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
        }

这样就可以访问php文件了。

======================================

以下为开机启动设置:

php-fpm 要写开机启动脚本 放到/etc/init.d目录下  然后

chkconfig --add php-fpm

chkconfig php-fpm on

chkconfig nginx on

chkconfig mysqld on

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 7.9.2009是CentOS操作系统的一个版本。你可以从以下镜像站点之一下载它:http://ftp.sjtu.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.njupt.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.bupt.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.cqu.edu.cn/CentOS/7.9.2009/isos/x86_64/,http://mirrors.neusoft.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.bfsu.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirror.lzu.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/,http://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.ustc.edu.cn/centos/7.9.2009/isos/x86_64/,http://mirrors.nju.edu.cn/centos/7.9.2009/isos/x86_64/。 如果你想在CentOS上部署一个要求Python版本大于3.6的项目,你可以通过以下命令来升级Python版本: ``` rm -f /usr/bin/python ln -s /usr/local/bin/python3 /usr/bin/python rm /usr/bin/pip ln -s /usr/local/bin/pip /usr/bin/pip ``` 这将删除旧的Python符号链接并创建一个指向新的Python版本的符号链接。 CentOS 7.9.2009提供了几个不同的版本供下载。完整版(CentOS-7-x86_64-Everything-2207-02.iso)包含了所有软件,适合补充系统的软件或者填充本地镜像。精简版(CentOS-7-x86_64-Minimal-2207-02.iso)则自带的软件最少。还有一个网络安装版(CentOS-7-x86_64-NetInstall-2009.iso),可以用于网络安装或者救援系统。 如果你想使用虚拟机来运行CentOS 7.9.2009,你可以下载CentOS-7-x86_64-Minimal-2009虚拟机文件(VMware 15)。在导入虚拟机时,请选择复制而不是移动。默认的虚拟机登录凭据为root/sir,IP网段为192.168.32.102。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值