记一次在AlibabaCloud3上部署Apache+PHP+MySQL的过程

本文目标

  1. 安装任意版本Apache2
  2. 安装php8.2
  3. 安装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

参考文章

评论

  1. 1 月前
    2024-10-16 1:39:06

    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

  2. 1 月前
    2024-10-16 0:05:19

    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

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇