CentOS下yum安装LEMP环境

参考

https://www.mf8.biz/rhel-centos-8-install-php/

1.创建docker

docker run -tid --name "lemp-latest" --privileged  centos:7 /usr/sbin/init

docker exec -ti lemp-latest bash

2.安装PHP

REMI源——CentOS8+的推荐方式

yum -y install https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm

# yum源管理工具
yum -y install yum-utils

phpversion=php74

yum install -y $phpversion-php-fpm $phpversion-php-cli $phpversion-php-bcmath $phpversion-php-gd $phpversion-php-json $phpversion-php-mbstring $phpversion-php-mcrypt $phpversion-php-mysqlnd $phpversion-php-opcache $phpversion-php-pdo $phpversion-php-pecl-crypto $phpversion-php-pecl-mcrypt $phpversion-php-pecl-geoip $phpversion-php-recode $phpversion-php-snmp $phpversion-php-soap $phpversion-php-xml

# 关闭path_info
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/opt/remi/php74/php.ini

# 重启php
systemctl restart $phpversion-php-fpm

# 设置开机启动
systemctl enable $phpversion-php-fpm

# 更多操作
systemctl restart $phpversion-php-fpm #重启
systemctl start $phpversion-php-fpm #启动
systemctl stop $phpversion-php-fpm #关闭
systemctl status $phpversion-php-fpm #检查状态

# 添加软链接
ln -s /usr/bin/php74 /usr/bin/php

# 测试
php -v

3.安装Nginx

yum -y install nginx

0 thoughts on “CentOS下yum安装LEMP环境

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据