参考
CentOS8: 在 CentOS 8、RHEL8、OracleLinux8 上安装 PHP7.3 PHP5.6 教程 – 米饭粑 (mf8.biz)
CentOS7:在 CentOS RHEL 6/7 上安装 PHP7.3 教程 – 米饭粑 (mf8.biz)
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
Pingback: 创建一个 Docker 并开启 SSH 外部连接 - 乱世之牙