本文目标
- 安装任意版本Apache2
- 安装php8.2
- 安装MariaDB(其实是mariadb-server)
计划环境
Web程序用户: Web:Web
Web文件目录: /home/Web/Root/
安装Apache2
# 安装软件包
yum install -y httpd*
安装php8.2
# 添加remi仓库
rpm -ivh --nodeps https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf update -y dnf libdnf
sed -i 's/PLATFORM_ID="platform:al8"/PLATFORM_ID="platform:el8"/g' /etc/os-release
yum module install php:remi-8.0
sed -i 's/PLATFORM_ID="platform:el8"/PLATFORM_ID="platform:al8"/g' /etc/os-release
# 安装软件包
yum install -y php82 php82-php-fpm php82-php-cli php82-php-bcmath php82-php-gd php82-php-json php82-php-mbstring php82-php-mcrypt php82-php-mysqlnd php82-php-mysql php82-php-opcache php82-php-pdo php82-php-pecl-crypto php82-php-pecl-mcrypt php82-php-pecl-geoip php82-php-recode php82-php-snmp php82-php-soap php82-php-xml
# 启动php-fpm(令其能与apache交互)
systemctl enable --now php82-php-fpm
编辑配置文件 /etc/opt/remi/php82/php-fpm.d/www.conf
, 目的是将此处的user, listen.owner, group, listen.group以及都改为Web, 再顺带取消listen.mode的注释, 设置权限为0660(允许同组读写), 记下listen的值(/var/opt/remi/php82/run/php-fpm/www.sock
), 以便后续配置apache2与其相连
记得保证listen.acl_users和listen.acl_groups处于注释状态.
# 重启一下服务
systemctl restart php82-php-fpm
# 如果权限不是你刚刚配置的那样, 就手动改一下
ls -lab /var/opt/remi/php82/run/php-fpm/www.sock
# (备用) 手动修改文件的权限(默认是root, 重新启动的时候可能会删不掉)
systemctl stop php82-php-fpm
chown Web /var/opt/remi/php82/run/php-fpm/www.sock
chgrp Web /var/opt/remi/php82/run/php-fpm/www.sock
systemctl start php82-php-fpm
编辑/etc/httpd/conf.d/php82-php.conf
的配置令其连接上该fd, 主要是SetHandler字段, 将其改为SetHandler "proxy:unix:/var/opt/remi/php82/run/php-fpm/www.sock|fcgi://localhost/"
systemctl restart httpd
安装MariaDB
# 安装软件包
yum install -y mariadb-server
# 启动服务
systemctl enable --now mariadb
# 设置root密码
mysql_secure_installation
I do not even know how I ended up here but I thought this post was great I do not know who you are but certainly youre going to a famous blogger if you are not already Cheers
Nice blog here Also your site loads up very fast What host are you using Can I get your affiliate link to your host I wish my site loaded up as quickly as yours lol