ECS – 永夜 https://www.shuijingwanwq.com 没有不值得去解决的问题,也没有不值得去学习的技术! Thu, 04 Jun 2026 05:14:26 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.0 告别密码与断连:阿里云 ECS SSH 免密登录与心跳保活实践 https://www.shuijingwanwq.com/2026/06/04/15743/ https://www.shuijingwanwq.com/2026/06/04/15743/#respond Thu, 04 Jun 2026 05:14:25 +0000 https://www.shuijingwanwq.com/?p=15743 Post Views: 28

每次 ssh root@xxx 都要输密码?连上服务器后十分钟没操作就卡死?本文分享一套完整的解决方案,让你在 Ubuntu 终端中一键免密登录阿里云 ECS,同时保持连接永不冻结。

背景:两个烦人的问题

作为一名经常在 Ubuntu 终端中连接阿里云 ECS 的开发者,我每天都要执行:

ssh root@121.40.248.29

然后输入一长串密码。

然后输入一长串密码。

更崩溃的是,有时候去倒杯水、看个文档,回来发现终端已经“死”了——按 Ctrl+C 没反应,按 Enter 也没反应,只能无奈地关闭窗口,还提示“某些进程仍在运行”。

更崩溃的是,有时候去倒杯水、看个文档,回来发现终端已经“死”了——按 Ctrl+C 没反应,按 Enter 也没反应,只能无奈地关闭窗口,还提示“某些进程仍在运行”。

在阿里云杭州 ECS(Alibaba Cloud Linux 3)上,我通过摸索找到了两个简单有效的解决方案:

  1. SSH 密钥免密登录 – 告别输密码
  2. 配置心跳保活 – 告别连接卡死

下面是完整的实践过程,配有控制台和终端的真实截图。


第一步:在阿里云控制台创建密钥对

登录 阿里云 ECS 控制台,在左侧导航栏找到 “网络与安全” > “密钥对”

图3:密钥对管理入口

点击 “创建密钥对”,弹出表单:

  • 密钥对名称:输入一个易记的名字,例如 Ubuntu-26.04
  • 创建类型:选择 “自动创建密钥对”(推荐,系统会生成公钥并自动托管,私钥由你下载保管)
  • 资源组:可选,一般不需要选择,直接跳过即可
图4:填写密钥对信息

点击 确定 后,浏览器会自动下载一个 .pem 文件(私钥)。这是唯一一次下载机会,请妥善保存。我的文件名是 Ubuntu-26.04.pem

第二步:绑定密钥对到 ECS 实例

在密钥对列表中找到刚刚创建的 Ubuntu-26.04,点击 “绑定密钥对”

图5:选择要绑定的实例

勾选你的目标 ECS 实例(IP 为 121.40.248.29 的那台),点击确定。系统会提示 “需要重启实例才能生效”。在业务低峰期,确认重启实例。

💡 重启可以在控制台操作,也可以登录实例执行 reboot。重启后密钥对绑定才真正生效。

第三步:本地配置私钥与 SSH 客户端

回到你的 Ubuntu 本地终端(我是 ThinkPad T570 + Ubuntu 26.04)。

1. 移动私钥文件并设置权限

我的 Ubuntu-26.04.pem 下载到了 ~/下载/ 目录(中文路径)。先创建 .ssh 目录,然后移动并改名:

mkdir -p ~/.ssh
mv ~/下载/Ubuntu-26.04.pem ~/.ssh/aliyun.pem
chmod 600 ~/.ssh/aliyun.pem   # 必须!否则 SSH 会报权限过宽的错误

⚠️ 如果下载到了 ~/Downloads/,请相应调整路径。

2. 配置 SSH 客户端(简化登录命令)

编辑(或创建)~/.ssh/config 文件:

nano ~/.ssh/config

加入以下内容:

Host aliyun
    HostName 121.40.248.29
    User root
    IdentityFile ~/.ssh/aliyun.pem
    ServerAliveInterval 60      # 心跳保活,每60秒发一个空包

保存退出(Ctrl+X,然后 Y,再 Enter)。

  • Host aliyun 是自定义别名,以后只需 ssh aliyun 即可。
  • ServerAliveInterval 60 是解决“10分钟后无反应”的关键。

3. 测试免密登录

ssh aliyun

从截图中可以看到,我连续执行了 mvchmodnano,最后 ssh aliyun 一气呵成,直接显示欢迎信息和上次登录时间,没有任何密码询问。

从截图中可以看到,我连续执行了 mv、chmod、nano,最后 ssh aliyun 一气呵成,直接显示欢迎信息和上次登录时间,没有任何密码询问。

第四步:解决连接卡死的原理

之前出现的“10分钟后无反应”,是因为网络中间设备(如防火墙、NAT)认为空闲连接没有数据传输,就把它断开了。ServerAliveInterval 60 的作用是让本地 SSH 客户端每隔 60 秒自动向服务器发送一个空的“心跳”包,维持连接的活跃状态。即使你发呆一小时,连接也不会中断。

安全建议:限制安全组来源 IP

为了进一步提升安全性,建议在阿里云控制台配置安全组,只允许你的本地公网 IP 访问 22 端口:

  1. 在本地执行 curl ifconfig.me 获取当前公网 IP。
  2. 进入 ECS 实例详情 → 安全组 → 配置规则 → 入方向。
  3. 找到 SSH(22)那条规则,将授权对象从 0.0.0.0/0 改为 你的IP地址/32

这样即使私钥不慎泄露,别人也无法从别的 IP 登录你的服务器。

总结

通过以上几步,我彻底告别了:

  • ❌ 每次输入密码
  • ❌ 连接十分钟后无故卡死

现在只需要在终端敲 ssh aliyun 就能秒级登录,干其他事情回来,终端依然流畅响应。而且整个过程没有使用任何第三方软件(如 PuTTY),纯原生 SSH 配置,在 Ubuntu 终端下完美运行。

如果你也受困于同样的烦恼,不妨按本文操作一遍,相信十分钟内就能搞定。

最后的提醒:请妥善保管下载的 .pem 私钥文件,不要上传到公共代码仓库。如果需要多台电脑免密登录,可以重复使用同一个密钥对(将私钥复制到其他电脑的 ~/.ssh/ 目录并设置权限即可)。


实践环境:Ubuntu 26.04 (本地) + Alibaba Cloud Linux 3 (ECS,杭州节点)
如有问题欢迎留言交流。

]]>
https://www.shuijingwanwq.com/2026/06/04/15743/feed/ 0
我的个人博客,今天突然响应 504 的排查解决流程 https://www.shuijingwanwq.com/2026/02/25/9317/ https://www.shuijingwanwq.com/2026/02/25/9317/#comments Wed, 25 Feb 2026 09:47:46 +0000 https://www.shuijingwanwq.com/?p=9317 Post Views: 180

1、我的个人博客,今天突然响应 504 的排查解决流程。如图1

我的个人博客,今天突然响应 504

2、504 Gateway Timeout 说明 Nginx(或其他反向代理)等待后端(PHP-FPM)响应超时了。按以下顺序排查:

3、执行 top 命令,结果显示如下:问题很明确了,服务器严重过载。关键数据:负载 19.77(正常应该在 1-2 以下)、21 个进程在跑(太多了)、CPU 占用 87.4%、内存 1968MB 只剩 96MB 可用。这台是 2G 内存的小机器,已经被压垮了。如图2

执行 top 命令,结果显示如下:问题很明确了,服务器严重过载。关键数据:负载 19.77(正常应该在 1-2 以下)、21 个进程在跑(太多了)、CPU 占用 87.4%、内存 1968MB 只剩 96MB 可用。这台是 2G 内存的小机器,已经被压垮了。


top - 15:21:01 up 993 days,  3:25,  1 user,  load average: 18.68, 19.55, 19.55
Tasks: 139 total,  20 running, 119 sleeping,   0 stopped,   0 zombie
%Cpu(s): 88.0 us,  9.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  1.3 hi,  1.7 si,  0.0 st
MiB Mem :   1968.6 total,     76.8 free,   1481.2 used,    410.6 buff/cache
MiB Swap:   2048.0 total,   1816.6 free,    231.4 used.    262.7 avail Mem


3、退出 top,执行:ps aux –sort=-%cpu | head -20,看是什么进程在吃资源。原因找到了。15+ 个 PHP-FPM 子进程同时运行,每个占 110MB 内存,光 PHP-FPM 就吃掉了将近 1.6GB,服务器总共才 2GB 内存,直接撑爆了。



[root@iZ23wv7v5ggZ ~]# ps aux --sort=-%cpu | head -20
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www      2097069  5.6  5.4 583184 109280 ?       S    14:41   2:29 php-fpm: pool www
www      2097086  5.6  5.3 583376 108720 ?       R    14:43   2:23 php-fpm: pool www
www      2097087  5.6  5.5 585100 111712 ?       R    14:43   2:22 php-fpm: pool www
www      2097088  5.6  5.4 583136 109108 ?       S    14:43   2:22 php-fpm: pool www
www      2097093  5.6  5.4 583132 109292 ?       R    14:44   2:18 php-fpm: pool www
www      2097094  5.6  5.4 583132 109344 ?       R    14:44   2:18 php-fpm: pool www
www      2097109  5.6  5.4 583372 109752 ?       R    14:45   2:16 php-fpm: pool www
www      2097125  5.6  5.4 583116 109200 ?       R    14:47   2:09 php-fpm: pool www
www      2097162  5.6  5.4 583324 109732 ?       R    14:49   2:01 php-fpm: pool www
www      2097187  5.6  5.4 583244 109848 ?       R    14:53   1:48 php-fpm: pool www
www      2097281  5.6  5.4 583124 109308 ?       R    15:03   1:17 php-fpm: pool www
www      2097299  5.6  5.4 583052 109328 ?       R    15:05   1:09 php-fpm: pool www
www      2097341  5.6  5.4 583116 109408 ?       S    15:10   0:52 php-fpm: pool www
www      2097671  5.6  5.5 583052 112304 ?       R    15:18   0:24 php-fpm: pool www
www      2097746  5.5  5.5 582836 111876 ?       S    15:24   0:02 php-fpm: pool www
www      2097747  5.4  5.5 582852 111988 ?       R    15:25   0:01 php-fpm: pool www
root     1007745  3.2  1.0 154220 20344 ?        Ssl   2025 7458:44 /usr/local/aegis/aegis_client/aegis_12_81/AliYunDunMonitor
root     2097357  0.5  7.7 516416 156836 ?       RNs  15:11   0:04 /usr/libexec/platform-python /usr/bin/dnf makecache --timer
root     1007719  0.3  0.3  99308  6048 ?        Ssl   2025 756:25 /usr/local/aegis/aegis_client/aegis_12_81/AliYunDun
[root@iZ23wv7v5ggZ ~]#


4、先紧急恢复,再查根因。先看看一共有多少个 PHP-FPM 进程。总计 17 个。



[root@iZ23wv7v5ggZ ~]# ps aux | grep php-fpm | grep -v grep | wc -l
17


5、编辑 PHP-FPM 配置,服务器只有 2GB 内存,修改为跑 5 个子进程,编辑文件 /usr/local/php/etc/php-fpm.conf。如图3

编辑 PHP-FPM 配置,服务器只有 2GB 内存,修改为跑 5 个子进程,编辑文件 /usr/local/php/etc/php-fpm.conf

修改前:



pm = dynamic
pm.max_children = 16
pm.start_servers = 10
pm.min_spare_servers = 8
pm.max_spare_servers = 16
pm.max_requests = 2048


修改后:



pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500


6、保存后重启:执行命令:如图4

保存后重启:执行命令:


[root@iZ23wv7v5ggZ ~]# service php-fpm restart
[root@iZ23wv7v5ggZ ~]# sudo systemctl restart php-fpm


7、执行 top 命令,结果显示如下。内存恢复了,从 96MB 空闲涨到 1214MB,PHP-FPM 调整生效了。负载也在下降(19.77 → 7.97)。但 CPU 还是 85.4%,还有 8 个进程在跑,不正常。



top - 15:55:11 up 993 days,  3:59,  1 user,  load average: 7.97, 11.01, 15.32
Tasks: 124 total,   8 running, 116 sleeping,   0 stopped,   0 zombie
%Cpu(s): 85.4 us,  9.9 sy,  0.0 ni,  1.0 id,  0.0 wa,  1.0 hi,  2.6 si,  0.0 st
MiB Mem :   1968.6 total,   1214.1 free,    302.7 used,    451.8 buff/cache
MiB Swap:   2048.0 total,   1878.8 free,    169.2 used.   1469.1 avail Mem


8、 看看是什么在吃 CPU:执行命令:ps aux –sort=-%cpu | head -10 ,5 个 PHP-FPM 进程全部跑满了,说明有持续的大量请求在打我的服务器。



[root@iZ23wv7v5ggZ ~]# ps aux --sort=-%cpu | head -10
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www      2098124 17.0  3.1 452724 63280 ?        R    15:57   0:06 php-fpm: pool www
www      2098123 16.8  2.9 452404 59716 ?        R    15:57   0:06 php-fpm: pool www
www      2098122 16.7  3.0 452868 61800 ?        R    15:57   0:06 php-fpm: pool www
www      2098125 16.7  2.9 452404 59712 ?        R    15:57   0:06 php-fpm: pool www
www      2098126 16.6  3.0 452732 60772 ?        R    15:57   0:06 php-fpm: pool www
root     1007745  3.2  1.0 154220 20160 ?        Ssl   2025 7460:16 /usr/local/aegis/aegis_client/aegis_12_81/AliYunDunMonitor
root     1007719  0.3  0.2  99308  5772 ?        Ssl   2025 756:31 /usr/local/aegis/aegis_client/aegis_12_81/AliYunDun
www      2040873  0.2  1.4 186640 29872 ?        R    Feb17  24:56 nginx: worker process
root         754  0.1  0.2 555732  4480 ?        Ssl   2023 2189:58 /usr/libexec/platform-python -Es /usr/sbin/tuned -l -P
[root@iZ23wv7v5ggZ ~]#


9、查我的博客的虚拟主机的访问日志,博客的单个 IP 访问量不大,但 IP 段很集中(222.167.251.x、143.20.219.x、66.92.14.x),看起来像是分布式爬虫。但每个 IP 才 2 次请求,不太可能是它们把服务器打爆。



[root@iZ23wv7v5ggZ ~]# tail -200 /data/wwwlogs/www.shuijingwanwq.com_nginx.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20
2 66.92.14.197
2 222.167.251.94
2 222.167.251.83
2 222.167.251.69
2 222.167.251.248
2 222.167.251.161
2 222.167.251.155
2 222.167.251.100
2 143.20.219.38
2 143.20.219.227
2 143.20.219.208
2 143.20.219.199
2 136.0.94.36
2 13.53.45.144
1 66.92.14.92
1 66.92.14.90
1 66.92.14.85
1 66.92.14.8
1 66.92.14.77
1 66.92.14.75


10、可能是其他虚拟主机的流量导致的。 查一下:看哪个日志文件最近写入最频繁。主要流量集中在我的博客(21MB 日志)和 access_nginx.log(7MB)。



<h1>看哪个日志文件最近写入最频繁</h1>
ls -lt /data/wwwlogs/*.log | head -10

-rw-r--r-- 1 www root 21765969 Feb 25 16:01 /data/wwwlogs/www.shuijingwanwq.com_nginx.log
-rw-r--r-- 1 www root  7330312 Feb 25 16:01 /data/wwwlogs/access_nginx.log
-rw-r--r-- 1 www root     2189 Feb 25 15:47 /data/wwwlogs/error_nginx.log
-rw-r--r-- 1 www root    48532 Feb 25 15:40 /data/wwwlogs/learn-php-app-0605-prod.wangqiang.store_nginx.log
-rw-r--r-- 1 www root   213953 Feb 25 11:03 /data/wwwlogs/tym-jammerall.shuijingwanwq.com_nginx.log
-rw-r--r-- 1 www root        0 Jun 16  2023 /data/wwwlogs/learn-php-app-0605-prod.shuijingwanwq.com_nginx.log
-rw-r--r-- 1 www root        0 Jun  8  2023 /data/wwwlogs/fanxiapp-wangqiang-larabbs.shuijingwanwq.com_nginx.log



11、看 access_nginx.log 的流量来源,找到了!183.129.189.60 这个 IP 在疯狂刷我的服务器,200 条日志里它占了 177 条。先封掉这个 IP:



[root@iZ23wv7v5ggZ ~]# tail -200 /data/wwwlogs/access_nginx.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -20
177 183.129.189.60
10 121.196.223.20
2 77.83.39.167
2 45.153.34.187
2 38.46.221.123
2 204.76.203.69
1 47.99.50.249
1 43.156.202.34
1 43.130.31.17
1 43.130.16.212
1 205.210.31.11


12、在阿里云控制台的安全组里加一条规则:登录阿里云控制台 → ECS → 安全组 → 找到我实例对应的安全组 → 添加规则 → 方向选”入方向”、策略选”拒绝”、源地址填 183.129.189.60、端口范围填 -1/-1(全部端口)。如图5

在阿里云控制台的安全组里加一条规则:登录阿里云控制台 → ECS → 安全组 → 找到我实例对应的安全组 → 添加规则 → 方向选"入方向"、策略选"拒绝"、源地址填 183.129.189.60、端口范围填 -1/-1(全部端口)

13、看现在还有谁在大量请求,183.129.189.60 还在刷!安全组 规则可能没生效。立即用 iptables 封禁。如图6

看现在还有谁在大量请求,183.129.189.60 还在刷!安全组 规则可能没生效。立即用 iptables 封禁


[root@iZ23wv7v5ggZ ~]# tail -500 /data/wwwlogs/access_nginx.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -10
473 183.129.189.60
10 121.196.223.20
3 81.29.142.6
2 77.83.39.167
2 45.153.34.187
2 38.46.221.123
2 204.76.203.69
1 47.99.50.249
1 43.156.202.34
1 43.130.31.17
[root@iZ23wv7v5ggZ ~]#


14、执行以下命令,返回 0,说明封禁成功了。



[root@iZ23wv7v5ggZ ~]# sleep 30 &amp;&amp; tail -100 /data/wwwlogs/access_nginx.log | grep "183.129.189.60" | wc -l
73


15、由于 iptables 不管用,在 Nginx 层面封。直接在 access_nginx.log 对应的那个虚拟主机配置里封。先找到是哪个虚拟主机。然后直接编辑 nginx.conf,保存后,重启 Nginx。如图7

由于 iptables 不管用,在 Nginx 层面封。直接在 access_nginx.log 对应的那个虚拟主机配置里封。先找到是哪个虚拟主机。然后直接编辑 nginx.conf,保存后,重启 Nginx。


[root@iZ23wv7v5ggZ ~]# grep -rl "access_nginx.log" /usr/local/nginx/conf/
/usr/local/nginx/conf/nginx.conf
[root@iZ23wv7v5ggZ ~]# vi /usr/local/nginx/conf/nginx.conf
[root@iZ23wv7v5ggZ ~]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@iZ23wv7v5ggZ ~]#


16、实时监控,等30秒看有没有新的。如果没有任何输出,说明封禁已经生效了。确认已经生效。但是,负载仍然很高,博客仍然响应 504



[root@iZ23wv7v5ggZ ~]# timeout 30 tail -f /data/wwwlogs/access_nginx.log | grep "183.129.189.60"



17、负载稳在 7.6,没有继续下降。还有其他东西在吃资源。看看现在的情况:



<h1>当前 PHP-FPM 进程状态</h1>
[root@iZ23wv7v5ggZ ~]# ps aux | grep "php-fpm" | grep -v grep | wc -l
6
<h1>实时看有没有那个 IP 的新请求</h1>
[root@iZ23wv7v5ggZ ~]# tail -20 /data/wwwlogs/access_nginx.log | awk '{print $4, $1}'
[25/Feb/2026:15:26:57 121.196.223.20
[25/Feb/2026:15:26:57 121.196.223.20
[25/Feb/2026:15:26:57 121.196.223.20
[25/Feb/2026:15:26:57 121.196.223.20
[25/Feb/2026:15:27:07 121.196.223.20
[25/Feb/2026:15:27:07 121.196.223.20
[25/Feb/2026:15:27:17 121.196.223.20
[25/Feb/2026:15:27:17 121.196.223.20
[25/Feb/2026:15:28:33 47.99.50.249
[25/Feb/2026:15:34:01 45.153.34.187
[25/Feb/2026:15:49:35 43.156.202.34
[25/Feb/2026:15:56:04 38.46.221.123
[25/Feb/2026:16:01:12 38.46.221.123
[25/Feb/2026:16:12:08 81.29.142.6
[25/Feb/2026:16:12:12 81.29.142.6
[25/Feb/2026:16:12:16 81.29.142.6
[25/Feb/2026:16:20:52 185.242.226.113
[25/Feb/2026:16:45:12 34.158.168.101
[25/Feb/2026:16:45:13 34.158.168.101
[25/Feb/2026:16:45:14 34.158.168.101
<h1>博客最近的请求</h1>
[root@iZ23wv7v5ggZ ~]# tail -20 /data/wwwlogs/www.shuijingwanwq.com_nginx.log | awk '{print $4, $1, $7}' | tail -10
[25/Feb/2026:16:56:34 143.20.219.229 /robots.txt
[25/Feb/2026:16:56:34 143.20.219.183 /tag/develop
[25/Feb/2026:16:56:34 222.167.251.252 /robots.txt
[25/Feb/2026:16:56:34 66.92.14.190 /robots.txt
[25/Feb/2026:16:56:34 222.167.251.15 /robots.txt
[25/Feb/2026:16:56:34 66.92.14.195 /robots.txt
[25/Feb/2026:16:56:34 136.0.94.155 /robots.txt
[25/Feb/2026:16:56:34 66.92.14.151 /robots.txt
[25/Feb/2026:16:56:35 143.20.219.77 /robots.txt
[25/Feb/2026:16:56:35 136.0.94.158 /robots.txt
<h1>我的服务器是几核的</h1>
[root@iZ23wv7v5ggZ ~]# nproc
1
[root@iZ23wv7v5ggZ ~]#


18、找到根因了。单核 CPU + 大量分布式爬虫。我的博客同一秒内被十几个不同 IP 同时请求,这些 IP 段(143.20.219.x、222.167.251.x、66.92.14.x、136.0.94.x)是分布式爬虫。单核机器根本扛不住。在 Nginx 里批量封这些爬虫 IP 段:



deny 183.129.189.60;
deny 143.20.219.0/24;
deny 222.167.251.0/24;
deny 66.92.14.0/24;
deny 136.0.94.0/24;


19、最后重启 ECS,然后在最近几天观察一下情况了。是否 504 还会出现不。问题已经解决了。总结一下我做的事情:

PHP-FPM max_children 从 16 降到了 5(适配单核 2GB)
Nginx 封了 5 个恶意 IP 段
重启 ECS 清掉了积压的进程

20、这次事故总结如下:

直接原因
IP 183.129.189.60 对服务器发起了恶意安全扫描,暴力探测 /core/static/ 路径下的敏感文件(settings.ini、secret.sql、database.json 等)。同时四个分布式爬虫 IP 段(143.20.219.x、222.167.251.x、66.92.14.x、136.0.94.x)在同一秒内大量并发请求我的博客。这些请求全部经过 PHP-FPM 处理。
根本原因
我的服务器是单核 CPU、2GB 内存,但 PHP-FPM 配置了 max_children = 16、start_servers = 10。每个 PHP-FPM 子进程占用约 110MB 内存,16 个进程 = 1.76GB,几乎吃光了全部 2GB 内存。这个配置在过去 993 天里刚好能撑住正常流量,但一直处于”临界状态”,没有任何余量应对突发流量。
雪崩过程
恶意扫描 + 爬虫流量涌入 → 16 个 PHP-FPM 进程全部被占满 → 内存耗尽,系统开始使用 swap → swap 在磁盘上,IO 变慢 → 每个请求处理时间变长 → 进程无法及时释放 → 新请求排队等待 → Nginx 等待 PHP-FPM 响应超时 → 返回 504 Gateway Timeout。CPU 负载从正常的 0.5 飙到 19.77,形成恶性循环。
解决措施
PHP-FPM max_children 从 16 降到 5,适配单核 2GB 的硬件配置。Nginx 层面封禁了恶意扫描 IP 和四个爬虫 IP 段,被封的请求直接返回 403,不再占用 PHP-FPM 进程。重启 ECS 清掉了积压的卡死进程。
经验教训
PHP-FPM 的进程数必须匹配服务器的硬件资源,单核 2GB 的机器最多跑 5 个进程。993 天未重启、未调整配置,长期处于资源临界状态是最大的隐患。服务器应该有基本的防护措施,比如 Nginx 限流(limit_req_zone)和恶意 IP 自动封禁,而不是裸跑等出事。

]]>
https://www.shuijingwanwq.com/2026/02/25/9317/feed/ 1
部署 Shopify PHP 主题应用扩展至生产环境的应用中(阿里云、ECS 中的 CentOS 7.7 64位、MySQL 5.7) https://www.shuijingwanwq.com/2023/07/20/7878/ https://www.shuijingwanwq.com/2023/07/20/7878/#respond Thu, 20 Jul 2023 01:42:15 +0000 https://www.shuijingwanwq.com/?p=7878 Post Views: 158

1、参考:部署 Shopify PHP 应用至生产环境(阿里云、ECS 中的 CentOS 7.7 64位、MySQL 5.7)

2、当在应用:learn-php-app-ubuntu-2004-0605 新建且部署主题应用扩展后。测试通过,符合预期。如图1

当在应用:learn-php-app-ubuntu-2004-0605 新建且部署主题应用扩展后。测试通过,符合预期

图1

3、上传本地环境中的应用:learn-php-app-ubuntu-2004-0605 中 web 下的代码至生产环境,目录:vendor、frontend/node_modules、frontend/dist 不上传。

4、上传代码至生产环境后,重新构建前端与后端。

[root@iZ23wv7v5ggZ frontend]# npm install
[root@iZ23wv7v5ggZ frontend]# SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef npm run build
[root@iZ23wv7v5ggZ frontend]# cd ..
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer build
> composer build-frontend-links
> ln -sf ../frontend/dist/assets public/assets && ln -sf ../frontend/dist/index.html public/index.html

5、在开发商店中测试生产环境的应用,可正常工作。

6、由于主题应用扩展需要基于 Shopify CLI 创建,但是生产环境中没有安装 Shopify CLI。创建与部署主题应用扩展只能够在本地环境中执行。只不过需要绑定的应用为生产环境中的应用(即合作伙伴中心的应用:learn-php-app-0605-prod)。复制learn-php-app-ubuntu-2004-0605 中的代码至目录:learn-php-app-0605-prod,目录:node_modules、web/vendor、web/frontend/node_modules、web/frontend/dist 不复制。最佳实践应该是这2个应用目录共用同一个 Git 仓库,以保持代码的同步。参考:Work on an existing app  。安装项目的依赖。

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$  sudo npm install

7、安装应用的依赖项后,检查版本以确保 Shopify CLI 可用。

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run shopify version

> learn-php-app-ubuntu-2004-0605@1.0.0 shopify
> shopify version

Current Shopify CLI version: 3.46.2
💡 Version 3.46.5 available! Run npm run shopify upgrade

8、运行 dev 命令,在第一次运行此命令时,将其连接到合作伙伴中心的现有应用程序:learn-php-app-0605-prod,选择对应的商店以预览应用,且不更新应用的 URL,以避免影响到生产环境的应用使用。如图2

运行 dev 命令,在第一次运行此命令时,将其连接到合作伙伴中心的现有应用程序:learn-php-app-0605-prod,选择对应的商店以预览应用,且不更新应用的 URL,以避免影响到生产环境的应用使用

图2

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run dev

> learn-php-app-ubuntu-2004-0605@1.0.0 dev
> shopify app dev


Looks like this is the first time you're running dev for this project.
Configure your preferences by answering a few questions.


Before you preview your work, it needs to be associated with an app.

?  Create this project as a new app on Shopify?

>  (y) Yes, create it as a new app
   (n) No, connect it to an existing app

✔  No, connect it to an existing app

?  Which existing app is this for?

>  learn-php-app-0605-prod
   learn-php-app-ubuntu-2004-0605
   app-partners-20230530
   theme-app-ext-example1
   theme-app-extension-example
   learn-node-app-20230524
   learn-php-app-20230510
   learn-node-app-20230509
   learn-app-20221019
   learn-app

✔  learn-php-app-0605-prod

?  Which store would you like to use to view your project?

>  shuijingwanwq-development
   shuijingwanwq-development3
   shuijingwanwq-development2

✔  shuijingwanwq-development

?  Have Shopify automatically update your app's URL in order to create a preview experience?

       Current app URL:        • https://learn-php-app-0605-prod.shuijingwanwq.com/

       Current redirect URLs:  • https://learn-php-app-0605-prod.shuijingwanwq.com/api/auth/callback

   (1) Always by default
   (2) Yes, this time
   (3) No, not now
>  (4) Never, don't ask again

✔  Never, don't ask again

╭─ info ───────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  To make URL updates manually, you can add the following URLs as redirects   │
│  in your Partners Dashboard [1]:                                             │
│                                                                              │
│                                                                              │
│    • https://tiger-foto-incident-sparc.trycloudflare.com/auth/callback       │
│    • https://tiger-foto-incident-sparc.trycloudflare.com/auth/shopify/callb  │
│      ack                                                                     │
│    • https://tiger-foto-incident-sparc.trycloudflare.com/api/auth/callback   │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://partners.shopify.com/2442779/apps/44885082113/edit

theme-app-extension-0612 (Theme App Extension)
Follow the dev doc instructions ( https://shopify.dev/apps/online-store/theme-app-extensions/getting-started#step-3-test-your-changes ) by deploying your work as a draft

2023-06-15 03:17:46 │ frontend   │
2023-06-15 03:17:46 │ frontend   │ > shopify-frontend-template-react@1.0.0 dev
2023-06-15 03:17:46 │ frontend   │ > vite
2023-06-15 03:17:46 │ frontend   │
2023-06-15 03:17:47 │ backend    │ > Composer\Config::disableProcessTimeout
2023-06-15 03:17:47 │ backend    │ > php artisan serve
2023-06-15 03:17:47 │ backend    │ PHP Warning:  require(/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/vendor/autoload.php): Failed to open
                                   stream: No such file or directory in /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/artisan on line 18
2023-06-15 03:17:47 │ backend    │ PHP Fatal error:  Uncaught Error: Failed opening required
                                   '/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/vendor/autoload.php' (include_path='.:/usr/share/php') in
                                   /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/artisan:18
2023-06-15 03:17:47 │ backend    │ Stack trace:
2023-06-15 03:17:47 │ backend    │ #0 {main}
2023-06-15 03:17:47 │ backend    │   thrown in /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/artisan on line 18
2023-06-15 03:17:47 │ backend    │ Script php artisan serve handling the serve event returned with error code 255

Preview URL: https://tiger-foto-incident-sparc.trycloudflare.com?shop=shuijingwanwq-development.myshopify.com&host=c2h1a
Wppbmd3YW53cS1kZXZlbG9wbWVudC5teXNob3BpZnkuY29tL2FkbWlu

── external error ──────────────────────────────────────────────────────────────

Error coming from `composer serve`

Command failed with exit code 255: composer serve
> Composer\Config::disableProcessTimeout
> php artisan serve
PHP Warning:  require(/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/vendor/autoload.php): Failed to open
stream: No such file or directory in /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/artisan on line 18
PHP Fatal error:  Uncaught Error: Failed opening required
'/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/vendor/autoload.php' (include_path='.:/usr/share/php') in
/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/artisan:18
Stack trace:
#0 {main}
  thrown in /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web/artisan on line 18
Script php artisan serve handling the serve event returned with error code 255

────────────────────────────────────────────────────────────────────────────────

9、执行命令:composer serve 时报错,因为 PHP 的依赖项还未安装。不过,主题应用扩展:theme-app-extension-0612 已经推送至合作伙伴中心。如图3

执行命令:composer serve 时报错,因为 PHP 的依赖项还未安装。不过,主题应用扩展:theme-app-extension-0612 已经推送至合作伙伴中心

图3

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/web$ composer install

10、启用开发商店预览后,执行 deploy 命令后,可以创建扩展版本,然后安装过此应用的店铺便可以使用此主题应用扩展。无法创建扩展版本,不符合预期。如图4

启用开发商店预览后,执行 deploy 命令后,可以创建扩展版本,然后安装过此应用的店铺便可以使用此主题应用扩展。无法创建扩展版本,不符合预期

图4

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run deploy

> learn-php-app-ubuntu-2004-0605@1.0.0 deploy
> shopify app deploy

?  Make the following changes to your extensions in Shopify Partners?
✔  Yes, deploy to push changes


Deploying your work to Shopify Partners. It will be part of learn-php-app-ubuntu-2004-0605

 theme_extensions │ Running theme check on your Theme app extension...
 theme_extensions │ Checking /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/extensions/theme-app-extension-0612 ...
 theme_extensions │ 4 files inspected, 0 offenses detected, 0 offenses auto-correctable


╭─ success ────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Deployed to Shopify!                                                        │
│                                                                              │
│  Summary                                                                     │
│    • theme-app-extension-0612 is deployed to Shopify but not yet live        │
│                                                                              │
│  Next steps                                                                  │
│    • Publish theme-app-extension-0612 [1]                                    │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://partners.shopify.com/2442779/apps/44874072065/extensions/theme_app_extension/25583255553

11、发现仍然是被推送部署至复制前的应用 learn-php-app-ubuntu-2004-0605 。如图5

发现仍然是被推送部署至复制前的应用 learn-php-app-ubuntu-2004-0605

图5

12、重新运行开发(重新配置)命令。在执行过程中,存在:Pushed » ‘theme-app-extension-0612’ to a draft。已经可以创建应用扩展的版本。如图6

重新运行开发(重新配置)命令。在执行过程中,存在:Pushed » 'theme-app-extension-0612' to a draft。已经可以创建应用扩展的版本

图6

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run dev -- --reset

> learn-php-app-ubuntu-2004-0605@1.0.0 dev
> shopify app dev --reset


Before you preview your work, it needs to be associated with an app.

?  Create this project as a new app on Shopify?
✔  No, connect it to an existing app

?  Which existing app is this for?
✔  learn-php-app-0605-prod

?  Which store would you like to use to view your project?
✔  shuijingwanwq-development

?  Have Shopify automatically update your app's URL in order to create a preview experience?
✔  Never, don't ask again

╭─ info ───────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  To make URL updates manually, you can add the following URLs as redirects   │
│  in your Partners Dashboard [1]:                                             │
│                                                                              │
│                                                                              │
│    • https://shape-vaccine-crop-xl.trycloudflare.com/auth/callback           │
│    • https://shape-vaccine-crop-xl.trycloudflare.com/auth/shopify/callback   │
│    • https://shape-vaccine-crop-xl.trycloudflare.com/api/auth/callback       │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://partners.shopify.com/2442779/apps/44885082113/edit

theme-app-extension-0612 (Theme App Extension)
Follow the dev doc instructions ( https://shopify.dev/apps/online-store/theme-app-extensions/getting-started#step-3-test-your-changes ) by deploying your work as a draft

2023-06-15 05:54:27 │ frontend   │
2023-06-15 05:54:27 │ frontend   │ > shopify-frontend-template-react@1.0.0 dev
2023-06-15 05:54:27 │ frontend   │ > vite
2023-06-15 05:54:27 │ frontend   │
2023-06-15 05:54:29 │ webhooks   │ Sending APP_UNINSTALLED webhook to app server
2023-06-15 05:54:29 │ webhooks   │ App isn't responding yet, retrying in 5 seconds
2023-06-15 05:54:34 │ webhooks   │ App isn't responding yet, retrying in 5 seconds
2023-06-15 05:54:35 │ frontend   │
2023-06-15 05:54:35 │ frontend   │   VITE v4.3.9  ready in 7797 ms
2023-06-15 05:54:35 │ frontend   │
2023-06-15 05:54:35 │ frontend   │   ➜  Local:   http://localhost:33151/
2023-06-15 05:54:36 │ backend    │ > Composer\Config::disableProcessTimeout
2023-06-15 05:54:36 │ backend    │ > php artisan serve
2023-06-15 05:54:39 │ webhooks   │ App isn't responding yet, retrying in 5 seconds
2023-06-15 05:54:44 │ webhooks   │ App hasn't started in time, giving up
2023-06-15 05:54:44 │ webhooks   │ APP_UNINSTALLED webhook delivery failed
2023-06-15 05:54:54 │ backend    │ Starting Laravel development server: http://127.0.0.1:41775
2023-06-15 05:54:54 │ backend    │ [Thu Jun 15 13:54:54 2023] PHP 8.1.18 Development Server (http://127.0.0.1:41775) started
2023-06-15 05:55:21 │ extensions │
2023-06-15 05:55:21 │ extensions │ --------- Pushing theme files to App Ext. Host (96e4f9-DESKTOP-QLPK8QM) (#133838078137) on
                                   shuijingwanwq-development.myshopify.com
2023-06-15 05:55:21 │ extensions │ Pushing theme...     0%
2023-06-15 05:55:33 │ backend    │ [Thu Jun 15 13:55:33 2023] 127.0.0.1:42178 Accepted
2023-06-15 05:55:42 │ backend    │ [Thu Jun 15 13:55:42 2023] 127.0.0.1:42178 Closing
2023-06-15 05:55:42 │ backend    │ [Thu Jun 15 13:55:42 2023] 127.0.0.1:42184 Accepted
2023-06-15 05:55:45 │ backend    │ [Thu Jun 15 13:55:44 2023] 127.0.0.1:42184 Closing
2023-06-15 05:56:25 │ extensions │ Pushing theme...    36%
2023-06-15 05:56:27 │ extensions │ Pushing theme...    52%
2023-06-15 05:56:27 │ extensions │ Pushing theme...    68%
2023-06-15 05:56:27 │ extensions │ Pushing theme...    84%
2023-06-15 05:56:27 │ extensions │ Pushing theme...   100%
2023-06-15 05:56:29 │ extensions │ ------------------
2023-06-15 05:56:31 │ extensions │
2023-06-15 05:56:31 │ extensions │ --------- Viewing extension…
2023-06-15 05:56:31 │ extensions │ Enable your theme app extension:
2023-06-15 05:56:31 │ extensions │ https://partners.shopify.com/2442779/apps/44885082113/extensions/theme_app_extension/25719668737
2023-06-15 05:56:31 │ extensions │
2023-06-15 05:56:31 │ extensions │ Setup your theme app extension in the host theme:
2023-06-15 05:56:31 │ extensions │ https://shuijingwanwq-development.myshopify.com/admin/themes/133838078137/editor
2023-06-15 05:56:31 │ extensions │
2023-06-15 05:56:31 │ extensions │ Preview your theme app extension:
2023-06-15 05:56:31 │ extensions │ http://127.0.0.1:9292
2023-06-15 05:56:31 │ extensions │ ------------------
2023-06-15 05:56:34 │ extensions │ Pushed » 'theme-app-extension-0612' to a draft
2023-06-15 05:56:34 │ extensions │ - blocks/star_rating.liquid
2023-06-15 05:56:34 │ extensions │ - snippets/stars.liquid
2023-06-15 05:56:34 │ extensions │ - locales/en.default.json
2023-06-15 05:56:34 │ extensions │ - assets/thumbs-up.png
2023-06-15 06:39:08 │ extensions │ Stopping…

› Press p │ preview in your browser
› Press q │ quit

Preview URL: https://shape-vaccine-crop-xl.trycloudflare.com?shop=shuijingwanwq-development.myshopify.com&host=c2h1aWppb
md3YW53cS1kZXZlbG9wbWVudC5teXNob3BpZnkuY29tL2FkbWlu

13、应用:learn-php-app-0605-prod 已经被分发至店铺:shuijingwanwq-development3。如图7

应用:learn-php-app-0605-prod 已经被分发至店铺:shuijingwanwq-development3

图7

14、创建主题应用扩展的版本并发布:1.0.0。如图8

创建主题应用扩展的版本并发布:1.0.0

图8

15、打开店铺:shuijingwanwq-development3 的任一主题的编辑器,可通过添加应用块的方式,使用主题应用扩展。如图9

打开店铺:shuijingwanwq-development3 的任一主题的编辑器,可通过添加应用块的方式,使用主题应用扩展

图9

16、查看首页,主题应用扩展已经显示。如图10

查看首页,主题应用扩展已经显示

图10

17、更新主题扩展应用的代码后,执行部署命令。发现仍然是部署至复制前的应用:learn-php-app-ubuntu-2004-0605

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run deploy

> learn-php-app-ubuntu-2004-0605@1.0.0 deploy
> shopify app deploy

?  Make the following changes to your extensions in Shopify Partners?
✔  Yes, deploy to push changes


Deploying your work to Shopify Partners. It will be part of learn-php-app-ubuntu-2004-0605

 theme_extensions │ Running theme check on your Theme app extension...
 theme_extensions │ Checking /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/extensions/theme-app-extension-0612 ...
 theme_extensions │ 4 files inspected, 0 offenses detected, 0 offenses auto-correctable


╭─ success ────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Deployed to Shopify!                                                        │
│                                                                              │
│  Summary                                                                     │
│    • theme-app-extension-0612 is deployed to Shopify but not yet live        │
│                                                                              │
│  Next steps                                                                  │
│    • Publish theme-app-extension-0612 [1]                                    │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://partners.shopify.com/2442779/apps/44874072065/extensions/theme_app_extension/25583255553

18、重新执行 env pull 命令,以指定应用为:learn-php-app-0605-prod。以更新现有的应用与应用扩展的环境变量。如图11

重新执行 env pull 命令,以指定应用为:learn-php-app-0605-prod。以更新现有的应用与应用扩展的环境变量

图11

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run shopify app env pull

> learn-php-app-ubuntu-2004-0605@1.0.0 shopify
> shopify app env pull

?  Which existing app is this for?
✔  learn-php-app-0605-prod

Updated .env to be:

SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef
SHOPIFY_THEME_APP_EXTENSION_0612_ID=a680449a-9537-45bf-a010-4d8cadacf5e1

SHOPIFY_API_SECRET=4de64aa8281e97055cf7698bbe56039e
SCOPES=write_products

Here's what changed:

- SHOPIFY_API_KEY=02c894a155c74ca837babfcf043ae4ed
+ SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef
SHOPIFY_THEME_APP_EXTENSION_0612_ID=a680449a-9537-45bf-a010-4d8cadacf5e1
+ SHOPIFY_API_SECRET=4de64aa8281e97055cf7698bbe56039e
+ SCOPES=write_products

19、再次执行部署命令,然后创建新的扩展版本:1.2.0 并且发布。等待了大约 3 分钟左右,首页发生变化,已经应用到新的更改,从 0615 变化为 0616。如图12

再次执行部署命令,然后创建新的扩展版本:1.2.0 并且发布。等待了大约 3 分钟左右,首页发生变化,已经应用到新的更改,从 0615 变化为 0616

图12

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ npm run deploy

> learn-php-app-ubuntu-2004-0605@1.0.0 deploy
> shopify app deploy

?  Make the following changes to your extensions in Shopify Partners?
✔  Yes, deploy to push changes


Deploying your work to Shopify Partners. It will be part of learn-php-app-0605-prod

 theme_extensions │ Running theme check on your Theme app extension...
 theme_extensions │ Checking /mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/extensions/theme-app-extension-0612 ...
 theme_extensions │ 4 files inspected, 0 offenses detected, 0 offenses auto-correctable


╭─ success ────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Deployed to Shopify!                                                        │
│                                                                              │
│  Summary                                                                     │
│    • theme-app-extension-0612 is deployed to Shopify but not yet live        │
│                                                                              │
│  Next steps                                                                  │
│    • Publish theme-app-extension-0612 [1]                                    │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://partners.shopify.com/2442779/apps/44885082113/extensions/theme_app_extension/25719668737

]]>
https://www.shuijingwanwq.com/2023/07/20/7878/feed/ 0
部署 Shopify PHP 应用至生产环境(阿里云、ECS 中的 CentOS 7.7 64位、MySQL 5.7) https://www.shuijingwanwq.com/2023/07/13/7855/ https://www.shuijingwanwq.com/2023/07/13/7855/#comments Thu, 13 Jul 2023 03:06:29 +0000 https://www.shuijingwanwq.com/?p=7855 Post Views: 335

1、现有一个 Shopify PHP 应用,已经可在开发环境中预览。如图1

现有一个 Shopify PHP 应用,已经可在开发环境中预览

图1

2、现准备将其部署至生产环境。如果需要部署应用至生产环境,Shopify 建议创建一个单独的应用。此应用与开发、测试环境共用代码库,但是在 Shopify 合作伙伴中心有自己的记录和配置。以避免在开发和测试过程中影响到生产环境的应用。使用 Shopify 合作伙伴
从头开始创建应用:learn-php-app-0605-prod。如图2

使用 Shopify 合作伙伴从头开始创建应用:learn-php-app-0605-prod

图2

3、检索环境变量,以便可以在稍后的步骤中设置它们。记下 SCOPES、SHOPIFY_API_KEY 和 SHOPIFY_API_SECRET 值。 您需要将这些值设置为托管应用程序的环境变量。


wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-ubuntu-2004-0605$ npm run shopify app env show

> learn-php-app-ubuntu-2004-0605@1.0.0 shopify
> shopify app env show

?  Which existing app is this for?
&#x2714;  learn-php-app-0605-prod


    SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef
    SHOPIFY_API_SECRET=4de64aa8281e97055cf7698bbe56039e
    SCOPES=write_products



4、参考:基于阿里云的 ECS、RDS,将个人博客迁移升级至:Docker(基于预算考虑,最终未实现)、LNMP(CentOS 7.7、Nginx 1.16、MySQL 5.7、PHP 7.4)、HTTPS 的过程  ,之前的环境是基于 OneinStack 的自动安装。PHP 版本 7.4 已经不再符合 Shopify 应用的运行条件。需要升级至 8.1 版本,尽量与本地环境保持一致。


[root@iZ23wv7v5ggZ ~]# php -v
PHP 7.4.0 (cli) (built: Dec  5 2019 11:56:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies




wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-ubuntu-2004-0605$ php -v
PHP 8.1.18 (cli) (built: Apr 14 2023 04:39:24) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.18, Copyright (c), by Zend Technologies


5、参考:在 阿里云中的 CentOS 7.7 中卸载 PHP 7.4,然后安装 PHP 8

6、查看阿里云中的 ECS 的 Alibaba Cloud Linux 3 的 PHP 版本


[root@iZ23wv7v5ggZ ~]# php -v
PHP 8.1.19 (cli) (built: Jun  7 2023 11:34:24) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.19, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.19, Copyright (c), by Zend Technologies
[root@iZ23wv7v5ggZ ~]#



7、添加虚拟主机时,设置 SSL 证书失败:Let’s Encrypt Verify error! DNS problem,需要先设置域名的解析。


[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# ~/oneinstack/vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
        1. Use HTTP Only
        2. Use your own SSL Certificate and Key
        3. Use Let's Encrypt to Create SSL Certificate and Key
        q. Exit
Please input the correct option: 3

Please input domain(example: www.example.com): learn-php-app-0605-prod.shuijingwanwq.com
domain=learn-php-app-0605-prod.shuijingwanwq.com

Please input the directory for the domain:learn-php-app-0605-prod.shuijingwanwq.com :
(Default directory: /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com):
Virtual Host Directory=/data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com

Create Virtul Host directory......
set permissions of Virtual Host directory......

Do you want to add more domain name? [y/n]: n

Do you want to redirect all HTTP requests to HTTPS? [y/n]: y

Please select domain cert key length.
Enter one of 2048, 3072, 4096, 8192 will issue a RSA cert.
Enter one of ec-256, ec-384, ec-521 will issue a ECC cert.

Please enter your cert key length (default 2048):

Let's Encrypt Verify error! DNS problem: NXDOMAIN looking up A for learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun  7 04:44:59 PM CST 2023] Using CA: https://acme.zerossl.com/v2/DV90
[Wed Jun  7 04:44:59 PM CST 2023] Creating domain key
[Wed Jun  7 04:44:59 PM CST 2023] The domain key is here: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/learn-php-app-0605-prod.shuijingwanwq.com.key
[Wed Jun  7 04:44:59 PM CST 2023] Single domain='learn-php-app-0605-prod.shuijingwanwq.com'
[Wed Jun  7 04:44:59 PM CST 2023] Getting domain auth token for each domain
[Wed Jun  7 04:45:05 PM CST 2023] Getting webroot for domain='learn-php-app-0605-prod.shuijingwanwq.com'
[Wed Jun  7 04:45:05 PM CST 2023] Verifying: learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun  7 04:45:07 PM CST 2023] Processing, The CA is processing your order, please just wait. (1/30)
[Wed Jun  7 04:45:11 PM CST 2023] learn-php-app-0605-prod.shuijingwanwq.com:Verify error:"error":{
[Wed Jun  7 04:45:11 PM CST 2023] Please add '--debug' or '--log' to check more details.
[Wed Jun  7 04:45:11 PM CST 2023] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
Error: Create Let's Encrypt SSL Certificate failed!
[root@iZ23wv7v5ggZ www.shuijingwanwq.com]#



8、在阿里云 云解析DNS 中添加记录。如图3

在阿里云 云解析DNS 中添加记录

图3

9、再次添加虚拟主机


[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# ~/oneinstack/vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
        1. Use HTTP Only
        2. Use your own SSL Certificate and Key
        3. Use Let's Encrypt to Create SSL Certificate and Key
        q. Exit
Please input the correct option: 3

Please input domain(example: www.example.com): learn-php-app-0605-prod.shuijingwanwq.com
domain=learn-php-app-0605-prod.shuijingwanwq.com

Please input the directory for the domain:learn-php-app-0605-prod.shuijingwanwq.com :
(Default directory: /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com):
Virtual Host Directory=/data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com

Create Virtul Host directory......
set permissions of Virtual Host directory......

Do you want to add more domain name? [y/n]: n

Do you want to redirect all HTTP requests to HTTPS? [y/n]: y

Please select domain cert key length.
Enter one of 2048, 3072, 4096, 8192 will issue a RSA cert.
Enter one of ec-256, ec-384, ec-521 will issue a ECC cert.

Please enter your cert key length (default 2048):
[Wed Jun  7 04:51:49 PM CST 2023] Using CA: https://acme.zerossl.com/v2/DV90
[Wed Jun  7 04:51:49 PM CST 2023] Single domain='learn-php-app-0605-prod.shuijingwanwq.com'
[Wed Jun  7 04:51:49 PM CST 2023] Getting domain auth token for each domain
[Wed Jun  7 04:51:54 PM CST 2023] Getting webroot for domain='learn-php-app-0605-prod.shuijingwanwq.com'
[Wed Jun  7 04:51:54 PM CST 2023] Verifying: learn-php-app-0605-prod.shuijingwanwq.com
[Wed Jun  7 04:51:55 PM CST 2023] Processing, The CA is processing your order, please just wait. (1/30)
[Wed Jun  7 04:52:01 PM CST 2023] Success
[Wed Jun  7 04:52:01 PM CST 2023] Verify finished, start to sign.
[Wed Jun  7 04:52:01 PM CST 2023] Lets finalize the order.
[Wed Jun  7 04:52:01 PM CST 2023] Le_OrderFinalize='https://acme.zerossl.com/v2/DV90/order/CLf6pxWJkdxtQylgNxS_Jg/finalize'
[Wed Jun  7 04:52:02 PM CST 2023] Order status is processing, lets sleep and retry.
[Wed Jun  7 04:52:02 PM CST 2023] Retry after: 15
[Wed Jun  7 04:52:18 PM CST 2023] Polling order status: https://acme.zerossl.com/v2/DV90/order/CLf6pxWJkdxtQylgNxS_Jg
[Wed Jun  7 04:52:20 PM CST 2023] Downloading cert.
[Wed Jun  7 04:52:20 PM CST 2023] Le_LinkCert='https://acme.zerossl.com/v2/DV90/cert/B2uRnJRfyVAP2B9aqQ2_Lw'
[Wed Jun  7 04:52:22 PM CST 2023] Cert success.
-----BEGIN CERTIFICATE-----
*******************
-----END CERTIFICATE-----
[Wed Jun  7 04:52:22 PM CST 2023] Your cert is in: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/learn-php-app-0605-prod.shuijingwanwq.com.cer
[Wed Jun  7 04:52:22 PM CST 2023] Your cert key is in: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/learn-php-app-0605-prod.shuijingwanwq.com.key
[Wed Jun  7 04:52:22 PM CST 2023] The intermediate CA cert is in: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/ca.cer
[Wed Jun  7 04:52:22 PM CST 2023] And the full chain certs is there: /root/.acme.sh/learn-php-app-0605-prod.shuijingwanwq.com/fullchain.cer

Do you want to add hotlink protection? [y/n]: y

Allow Rewrite rule? [y/n]: y

Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog,whmcs rewrite was exist.
(Default rewrite: other): laravel
You choose rewrite=laravel

Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
You access log file=/data/wwwlogs/learn-php-app-0605-prod.shuijingwanwq.com_nginx.log

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################
Your domain:                  learn-php-app-0605-prod.shuijingwanwq.com
Virtualhost conf:             /usr/local/nginx/conf/vhost/learn-php-app-0605-prod.shuijingwanwq.com.conf
Directory of:                 /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com
Rewrite rule:                 /usr/local/nginx/conf/rewrite/laravel.conf
Let's Encrypt SSL Certificate:/usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.crt
SSL Private Key:              /usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.key
[root@iZ23wv7v5ggZ www.shuijingwanwq.com]#



10、添加FTP账号


[root@iZ23wv7v5ggZ www.shuijingwanwq.com]# ~/oneinstack/pureftpd_vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#                 FTP virtual user account management                 #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
        1. UserAdd
        2. UserMod
        3. UserPasswd
        4. UserDel
        5. ListAllUser
        6. ShowUser
        q. Exit
Please input the correct option: 1

Please input a username: learn-php-app-0605-prod.shuijingwanwq.com

Please input the password: XZzqpC4k3Clf6Oup26e

Please input the directory(Default directory: /data/wwwroot): /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com
Password:
Enter it again:
#####################################

[learn-php-app-0605-prod.shuijingwanwq.com] create successful!

You user name is : learn-php-app-0605-prod.shuijingwanwq.com
You Password is : ************
You directory is : /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com



11、此时,需要在本地环境中构建生产环境中的应用,避免在生产环境中构建,因为生产环境中暂不支持构建所需要的前提条件,比如说 npm、composer 等。SHOPIFY_API_KEY 需要使用 步骤 3 中检索出的变量值。复制应用目录 learn-php-app-ubuntu-2004-0605/web 为 learn-php-app-0605-prod。目录 learn-php-app-0605-prod 仅需要构建后,上传至生产环境,因此,开发环境的依赖文件皆不需要。


wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app$ cd learn-php-app-0605-prod/
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ ls -l
total 300
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:38 app
-rwxrwxrwx 1 wangqiang wangqiang   1690 Jun  5 15:02 artisan
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:38 bootstrap
-rwxrwxrwx 1 wangqiang wangqiang   2238 Jun  5 15:02 composer.json
-rwxrwxrwx 1 wangqiang wangqiang 304694 Jun  6 09:35 composer.lock
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:38 config
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:38 database
-rwxrwxrwx 1 wangqiang wangqiang    450 Jun  5 15:02 entrypoint.sh
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:39 frontend
-rwxrwxrwx 1 wangqiang wangqiang    860 Jun  5 15:00 nginx.conf
-rwxrwxrwx 1 wangqiang wangqiang   1202 Jun  5 15:00 phpunit.xml
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:39 public
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:39 resources
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:39 routes
-rwxrwxrwx 1 wangqiang wangqiang    563 Jun  5 15:00 server.php
-rwxrwxrwx 1 wangqiang wangqiang     75 Jun  5 15:00 shopify.web.toml
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:39 storage
drwxrwxrwx 1 wangqiang wangqiang   4096 Jun  7 17:42 vendor



12、编辑 .env ,设置为生产环境中的配置值


APP_NAME="Shopify PHP App 0605 Prod"
APP_ENV=production
APP_KEY=***********
APP_DEBUG=false

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=************
DB_PORT=3306
DB_DATABASE=learn_php_app_0605_prod
DB_USERNAME=learn_php_app_0605_prod
DB_PASSWORD=**********



13、构建前端与后端,报错:/bin/sh: 1: vite: not found,需要先执行:npm install 。如图4

构建前端与后端,报错:/bin/sh: 1: vite: not found,需要先执行:npm install

图4


wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/frontend$ SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef yarn build
yarn run v1.22.15
$ vite build
/bin/sh: 1: vite: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/frontend$ npm install
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.

added 354 packages, and audited 360 packages in 3m

41 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/frontend$ SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef npm run build

> shopify-frontend-template-react@1.0.0 build
> vite build

vite v4.3.9 building for production...
✓ 1966 modules transformed.
dist/assets/empty-state-8039a1e1.svg      0.26 kB │ gzip:   0.20 kB
dist/index.html                           0.48 kB │ gzip:   0.33 kB
dist/assets/home-trophy-d70b3542.png     20.65 kB
dist/assets/index-37530742.css          371.48 kB │ gzip:  45.42 kB
dist/assets/ko-ef9a93f5.js                0.21 kB │ gzip:   0.15 kB
dist/assets/ja-abb1af27.js                0.21 kB │ gzip:   0.15 kB
dist/assets/zh-4775ba45.js                0.21 kB │ gzip:   0.15 kB
dist/assets/th-32f01d1c.js                0.21 kB │ gzip:   0.15 kB
dist/assets/vi-72f55a87.js                0.23 kB │ gzip:   0.17 kB
dist/assets/nb-79727cd5.js                0.24 kB │ gzip:   0.17 kB
dist/assets/tr-d5c962f0.js                0.24 kB │ gzip:   0.17 kB
dist/assets/nl-ed6c02b1.js                0.28 kB │ gzip:   0.20 kB
dist/assets/de-5d4a5256.js                0.28 kB │ gzip:   0.20 kB
dist/assets/fi-e67a7779.js                0.28 kB │ gzip:   0.20 kB
dist/assets/da-9b835bb8.js                0.31 kB │ gzip:   0.22 kB
dist/assets/cs-d855408e.js                0.32 kB │ gzip:   0.23 kB
dist/assets/sv-8ac62b51.js                0.37 kB │ gzip:   0.25 kB
dist/assets/en-d265ad8d.js                0.41 kB │ gzip:   0.26 kB
dist/assets/es-fd2f35f4.js                0.41 kB │ gzip:   0.29 kB
dist/assets/pt-227fd344.js                0.41 kB │ gzip:   0.29 kB
dist/assets/pt-PT-a0c51464.js             0.41 kB │ gzip:   0.29 kB
dist/assets/pl-ab15c7ea.js                0.42 kB │ gzip:   0.29 kB
dist/assets/fr-23e50d95.js                0.43 kB │ gzip:   0.29 kB
dist/assets/it-08f76780.js                0.45 kB │ gzip:   0.30 kB
dist/assets/en-df34a502.js                1.53 kB │ gzip:   0.77 kB
dist/assets/de-2ae5c9fa.js                1.72 kB │ gzip:   0.90 kB
dist/assets/fr-5253333d.js                1.83 kB │ gzip:   0.94 kB
dist/assets/polyfill-force-11887b4b.js    5.21 kB │ gzip:   2.03 kB
dist/assets/zh-CN-cf74d136.js             7.72 kB │ gzip:   3.26 kB
dist/assets/zh-TW-6a74a185.js             7.86 kB │ gzip:   3.36 kB
dist/assets/ko-2cf626e6.js                8.18 kB │ gzip:   3.39 kB
dist/assets/ja-6f78282b.js                8.35 kB │ gzip:   3.58 kB
dist/assets/en-c240dff3.js                9.95 kB │ gzip:   2.95 kB
dist/assets/vi-e4ef4fd6.js                9.97 kB │ gzip:   3.34 kB
dist/assets/th-2a34d5e0.js               10.14 kB │ gzip:   3.77 kB
dist/assets/sv-a901b08f.js               10.22 kB │ gzip:   3.27 kB
dist/assets/da-1564850b.js               10.30 kB │ gzip:   3.26 kB
dist/assets/nb-0a6d8490.js               10.35 kB │ gzip:   3.25 kB
dist/assets/pl-a603e9c2.js               10.39 kB │ gzip:   3.39 kB
dist/assets/cs-3c753a97.js               10.40 kB │ gzip:   3.50 kB
dist/assets/fi-c0a9d95f.js               10.63 kB │ gzip:   3.41 kB
dist/assets/tr-bd45be97.js               10.68 kB │ gzip:   3.39 kB
dist/assets/it-8bb02787.js               10.72 kB │ gzip:   3.32 kB
dist/assets/pt-PT-af188c06.js            10.85 kB │ gzip:   3.34 kB
dist/assets/nl-0772ea77.js               10.89 kB │ gzip:   3.25 kB
dist/assets/pt-BR-8a1d5660.js            10.94 kB │ gzip:   3.36 kB
dist/assets/es-5e0e20e7.js               10.95 kB │ gzip:   3.39 kB
dist/assets/de-a04fe3bd.js               11.11 kB │ gzip:   3.35 kB
dist/assets/fr-1848494a.js               11.31 kB │ gzip:   3.48 kB
dist/assets/index-41437cc7.js            53.59 kB │ gzip:  18.93 kB
dist/assets/polyfill-904c231f.js        133.64 kB │ gzip:  40.74 kB
dist/assets/index-991532e3.js           618.82 kB │ gzip: 164.28 kB

(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 47.73s
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ composer build
> composer build-frontend-links
> ln -sf ../frontend/dist/assets public/assets &amp;&amp; ln -sf ../frontend/dist/index.html public/index.html
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod$ cd public/
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/shopify-app/learn-php-app-0605-prod/public$ ls -l
total 0
lrwxrwxrwx 1 wangqiang wangqiang   23 Jun  6 10:06 assets -> ../frontend/dist/assets
-rwxrwxrwx 1 wangqiang wangqiang    0 Jun  5 15:00 favicon.ico
lrwxrwxrwx 1 wangqiang wangqiang   27 Jun  8 09:45 index.html -> ../frontend/dist/index.html
-rwxrwxrwx 1 wangqiang wangqiang 1743 Jun  5 15:00 index.php
-rwxrwxrwx 1 wangqiang wangqiang   24 Jun  5 15:00 robots.txt


14、基于 FTP 上传 目录 learn-php-app-0605-prod 下的所有文件。总计大小为 150 MB 左右。上传时间过长,最张决定在生产环境中构建。目录:vendor、frontend/node_modules 不上传。如图5

基于 FTP 上传 目录 learn-php-app-0605-prod 下的所有文件。总计大小为 150 MB 左右。上传时间过长,最张决定在生产环境中构建。目录:vendor、frontend/node_modules 不上传

图5

15、安装 Node.js 与 Composer,Node.js 安装后需要重启实例


[root@iZ23wv7v5ggZ ~]# ~/oneinstack/install.sh --node

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

Download Nodejs...
--2023-06-08 10:45:47--  https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/v18.14.2/node-v18.14.2-linux-x64.tar.gz
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 44201520 (42M) [application/octet-stream]
Saving to: ‘node-v18.14.2-linux-x64.tar.gz’

     0K .......... .......... .......... .......... ..........  0%  878K 49s
    50K .......... .......... .......... .......... ..........  0% 1.79M 36s
 43150K .......... .....                                      100% 14.2M=2.7s

2023-06-08 10:45:50 (15.7 MB/s) - ‘node-v18.14.2-linux-x64.tar.gz’ saved [44201520/44201520]

Nodejs installed successfully!
[xprober.php] found
####################Congratulations########################
Total OneinStack Install Time: 0 minutes

[root@iZ23wv7v5ggZ ~]# node -v
-bash: node: command not found

[root@iZ23wv7v5ggZ ~]# ~/oneinstack/addons.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#                    Install/Uninstall Extensions                     #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
        1. Install/Uninstall PHP Composer
        2. Install/Uninstall fail2ban
        3. Install/Uninstall ngx_lua_waf
        4. Install/Uninstall Python3.6
        q. Exit
Please input the correct option: 1

Please select an action:
        1. install
        2. uninstall
Please input a number:(Default 1 press Enter) 1

PHP Composer installed successfully!

What Are You Doing?
        1. Install/Uninstall PHP Composer
        2. Install/Uninstall fail2ban
        3. Install/Uninstall ngx_lua_waf
        4. Install/Uninstall Python3.6
        q. Exit
Please input the correct option: q
[root@iZ23wv7v5ggZ ~]# composer -V
Composer version 2.5.7 2023-05-24 15:00:39
[root@iZ23wv7v5ggZ ~]# node -v
v18.14.2



16、当FTP上传完毕后,创建数据库(连接信息与 .env 中的保持一致),生成APP_KEY ,执行数据库迁移,构建前端与后端



[root@iZ23wv7v5ggZ frontend]# npm install
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.

added 359 packages, and audited 360 packages in 17s

41 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 9.5.0 -> 9.7.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.7.1
npm notice Run npm install -g npm@9.7.1 to update!
npm notice
[root@iZ23wv7v5ggZ frontend]# SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef npm run build

> shopify-frontend-template-react@1.0.0 build
> vite build

vite v4.3.9 building for production...
✓ 1966 modules transformed.
dist/assets/empty-state-8039a1e1.svg      0.26 kB │ gzip:   0.20 kB
dist/index.html                           0.48 kB │ gzip:   0.33 kB
dist/assets/home-trophy-d70b3542.png     20.65 kB
dist/assets/index-37530742.css          371.48 kB │ gzip:  45.42 kB
dist/assets/ja-abb1af27.js                0.21 kB │ gzip:   0.15 kB
dist/assets/ko-ef9a93f5.js                0.21 kB │ gzip:   0.15 kB
dist/assets/th-32f01d1c.js                0.21 kB │ gzip:   0.15 kB
dist/assets/zh-4775ba45.js                0.21 kB │ gzip:   0.15 kB
dist/assets/vi-72f55a87.js                0.23 kB │ gzip:   0.17 kB
dist/assets/nb-79727cd5.js                0.24 kB │ gzip:   0.17 kB
dist/assets/tr-d5c962f0.js                0.24 kB │ gzip:   0.17 kB
dist/assets/de-5d4a5256.js                0.28 kB │ gzip:   0.20 kB
dist/assets/fi-e67a7779.js                0.28 kB │ gzip:   0.20 kB
dist/assets/nl-ed6c02b1.js                0.28 kB │ gzip:   0.20 kB
dist/assets/da-9b835bb8.js                0.31 kB │ gzip:   0.22 kB
dist/assets/cs-d855408e.js                0.32 kB │ gzip:   0.23 kB
dist/assets/sv-8ac62b51.js                0.37 kB │ gzip:   0.25 kB
dist/assets/en-d265ad8d.js                0.41 kB │ gzip:   0.26 kB
dist/assets/es-fd2f35f4.js                0.41 kB │ gzip:   0.29 kB
dist/assets/pt-227fd344.js                0.41 kB │ gzip:   0.29 kB
dist/assets/pt-PT-a0c51464.js             0.41 kB │ gzip:   0.29 kB
dist/assets/pl-ab15c7ea.js                0.42 kB │ gzip:   0.29 kB
dist/assets/fr-23e50d95.js                0.43 kB │ gzip:   0.29 kB
dist/assets/it-08f76780.js                0.45 kB │ gzip:   0.30 kB
dist/assets/en-df34a502.js                1.53 kB │ gzip:   0.77 kB
dist/assets/de-2ae5c9fa.js                1.72 kB │ gzip:   0.90 kB
dist/assets/fr-5253333d.js                1.83 kB │ gzip:   0.94 kB
dist/assets/polyfill-force-11887b4b.js    5.21 kB │ gzip:   2.03 kB
dist/assets/zh-CN-cf74d136.js             7.72 kB │ gzip:   3.26 kB
dist/assets/zh-TW-6a74a185.js             7.86 kB │ gzip:   3.36 kB
dist/assets/ko-2cf626e6.js                8.18 kB │ gzip:   3.39 kB
dist/assets/ja-6f78282b.js                8.35 kB │ gzip:   3.58 kB
dist/assets/en-c240dff3.js                9.95 kB │ gzip:   2.95 kB
dist/assets/vi-e4ef4fd6.js                9.97 kB │ gzip:   3.34 kB
dist/assets/th-2a34d5e0.js               10.14 kB │ gzip:   3.77 kB
dist/assets/sv-a901b08f.js               10.22 kB │ gzip:   3.27 kB
dist/assets/da-1564850b.js               10.30 kB │ gzip:   3.26 kB
dist/assets/nb-0a6d8490.js               10.35 kB │ gzip:   3.25 kB
dist/assets/pl-a603e9c2.js               10.39 kB │ gzip:   3.39 kB
dist/assets/cs-3c753a97.js               10.40 kB │ gzip:   3.50 kB
dist/assets/fi-c0a9d95f.js               10.63 kB │ gzip:   3.41 kB
dist/assets/tr-bd45be97.js               10.68 kB │ gzip:   3.39 kB
dist/assets/it-8bb02787.js               10.72 kB │ gzip:   3.32 kB
dist/assets/pt-PT-af188c06.js            10.85 kB │ gzip:   3.34 kB
dist/assets/nl-0772ea77.js               10.89 kB │ gzip:   3.25 kB
dist/assets/pt-BR-8a1d5660.js            10.94 kB │ gzip:   3.36 kB
dist/assets/es-5e0e20e7.js               10.95 kB │ gzip:   3.39 kB
dist/assets/de-a04fe3bd.js               11.11 kB │ gzip:   3.35 kB
dist/assets/fr-1848494a.js               11.31 kB │ gzip:   3.48 kB
dist/assets/index-41437cc7.js            53.59 kB │ gzip:  18.93 kB
dist/assets/polyfill-904c231f.js        133.64 kB │ gzip:  40.74 kB
dist/assets/index-991532e3.js           618.82 kB │ gzip: 164.28 kB

(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 21.56s
[root@iZ23wv7v5ggZ frontend]# cd ..
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - league/flysystem is locked to version 1.1.10 and an update of this package was not requested.
    - league/flysystem 1.1.10 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
  Problem 2
    - league/mime-type-detection is locked to version 1.11.0 and an update of this package was not requested.
    - league/mime-type-detection 1.11.0 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
  Problem 3
    - league/flysystem 1.1.10 requires ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - laravel/framework v8.83.27 requires league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.10].
    - laravel/framework is locked to version v8.83.27 and an update of this package was not requested.

To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/php/etc/php.ini
    - /usr/local/php/etc/php.d/02-opcache.ini
    - /usr/local/php/etc/php.d/03-imagick.ini
    - /usr/local/php/etc/php.d/04-ldap.ini
    - /usr/local/php/etc/php.d/05-redis.ini
    - /usr/local/php/etc/php.d/07-mongodb.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.



17、安装 PHP 扩展 fileinfo 后,再次执行。报错:The Process class relies on proc_open, which is not available on your PHP installation.

[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 114 installs, 0 updates, 0 removals
proc_open is disabled so 'unzip' and '7z' commands cannot be used, zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Enabling proc_open and installing 'unzip' or '7z' (21.01+) may remediate them.
  - Downloading brick/math (0.11.0)
  - Downloading psr/log (2.0.0)
  - Downloading psr/cache (3.0.0)
  - Downloading doctrine/event-manager (2.0.0)
  - Downloading doctrine/deprecations (v1.1.1)
  - Downloading doctrine/cache (2.2.0)
  - Downloading doctrine/dbal (3.6.3)
  - Downloading doctrine/lexer (1.2.3)
  - Downloading symfony/polyfill-ctype (v1.27.0)
  - Downloading webmozart/assert (1.11.0)
  - Downloading dragonmantank/cron-expression (v3.3.2)
  - Downloading symfony/polyfill-php80 (v1.27.0)
  - Downloading symfony/polyfill-mbstring (v1.27.0)
  - Downloading symfony/var-dumper (v5.4.24)
  - Downloading symfony/polyfill-intl-normalizer (v1.27.0)
  - Downloading symfony/polyfill-intl-grapheme (v1.27.0)
  - Downloading symfony/string (v6.3.0)
  - Downloading symfony/deprecation-contracts (v3.3.0)
  - Downloading psr/container (1.1.2)
  - Downloading symfony/service-contracts (v2.5.2)
  - Downloading symfony/polyfill-php73 (v1.27.0)
  - Downloading symfony/console (v5.4.24)
  - Downloading monolog/monolog (2.9.1)
  - Downloading voku/portable-ascii (1.6.1)
  - Downloading phpoption/phpoption (1.9.1)
  - Downloading graham-campbell/result-type (v1.1.1)
  - Downloading vlucas/phpdotenv (v5.5.0)
  - Downloading symfony/css-selector (v6.3.0)
  - Downloading tijsverkoyen/css-to-inline-styles (2.2.6)
  - Downloading symfony/routing (v5.4.22)
  - Downloading symfony/process (v5.4.24)
  - Downloading symfony/polyfill-php72 (v1.27.0)
  - Downloading symfony/polyfill-intl-idn (v1.27.0)
  - Downloading symfony/mime (v5.4.23)
  - Downloading symfony/http-foundation (v5.4.24)
  - Downloading psr/event-dispatcher (1.0.0)
  - Downloading symfony/event-dispatcher-contracts (v3.3.0)
  - Downloading symfony/event-dispatcher (v6.3.0)
  - Downloading symfony/error-handler (v5.4.24)
  - Downloading symfony/http-kernel (v5.4.24)
  - Downloading symfony/finder (v5.4.21)
  - Downloading symfony/polyfill-iconv (v1.27.0)
  - Downloading egulias/email-validator (2.1.25)
  - Downloading swiftmailer/swiftmailer (v6.3.0)
  - Downloading ramsey/collection (2.0.0)
  - Downloading ramsey/uuid (4.7.4)
  - Downloading psr/simple-cache (1.0.1)
  - Downloading opis/closure (3.6.3)
  - Downloading symfony/translation-contracts (v3.3.0)
  - Downloading symfony/translation (v6.3.0)
  - Downloading nesbot/carbon (2.67.0)
  - Downloading league/mime-type-detection (1.11.0)
  - Downloading league/flysystem (1.1.10)
  - Downloading nette/utils (v4.0.0)
  - Downloading nette/schema (v1.2.3)
  - Downloading dflydev/dot-access-data (v3.0.2)
  - Downloading league/config (v1.2.0)
  - Downloading league/commonmark (2.4.0)
  - Downloading laravel/serializable-closure (v1.3.0)
  - Downloading doctrine/inflector (2.0.6)
  - Downloading laravel/framework (v8.83.27)
  - Downloading facade/ignition-contracts (1.0.2)
  - Downloading facade/flare-client-php (1.10.0)
  - Downloading facade/ignition (2.17.7)
  - Downloading fakerphp/faker (v1.22.0)
  - Downloading fideloper/proxy (4.4.2)
  - Downloading fruitcake/php-cors (v1.2.0)
  - Downloading fruitcake/laravel-cors (v3.0.0)
  - Downloading guzzlehttp/promises (2.0.0)
  - Downloading symfony/yaml (v6.3.0)
  - Downloading laravel/sail (v1.22.0)
  - Downloading nikic/php-parser (v4.15.5)
  - Downloading psy/psysh (v0.11.18)
  - Downloading laravel/tinker (v2.8.1)
  - Downloading hamcrest/hamcrest-php (v2.0.1)
  - Downloading mockery/mockery (1.6.1)
  - Downloading filp/whoops (2.15.2)
  - Downloading nunomaduro/collision (v5.11.0)
  - Downloading sebastian/version (3.0.2)
  - Downloading sebastian/type (3.2.1)
  - Downloading sebastian/resource-operations (3.0.3)
  - Downloading sebastian/recursion-context (4.0.5)
  - Downloading sebastian/object-reflector (2.0.4)
  - Downloading sebastian/object-enumerator (4.0.4)
  - Downloading sebastian/global-state (5.0.5)
  - Downloading sebastian/exporter (4.0.5)
  - Downloading sebastian/environment (5.1.5)
  - Downloading sebastian/diff (4.0.5)
  - Downloading sebastian/comparator (4.0.8)
  - Downloading sebastian/code-unit (1.0.8)
  - Downloading sebastian/cli-parser (1.0.1)
  - Downloading phpunit/php-timer (5.0.3)
  - Downloading phpunit/php-text-template (2.0.4)
  - Downloading phpunit/php-invoker (3.1.1)
  - Downloading phpunit/php-file-iterator (3.0.6)
  - Downloading theseer/tokenizer (1.2.1)
  - Downloading sebastian/lines-of-code (1.0.3)
  - Downloading sebastian/complexity (2.0.2)
  - Downloading sebastian/code-unit-reverse-lookup (2.0.3)
  - Downloading phpunit/php-code-coverage (9.2.26)
  - Downloading phar-io/version (3.2.1)
  - Downloading phar-io/manifest (2.0.3)
  - Downloading myclabs/deep-copy (1.11.1)
  - Downloading doctrine/instantiator (2.0.0)
  - Downloading phpunit/phpunit (9.6.8)
  - Downloading psr/http-message (1.1)
  - Downloading psr/http-factory (1.0.2)
  - Downloading ralouphie/getallheaders (3.0.3)
  - Downloading psr/http-client (1.0.2)
  - Downloading guzzlehttp/psr7 (2.5.0)
  - Downloading guzzlehttp/guzzle (7.7.0)
  - Downloading firebase/php-jwt (v6.5.0)
  - Downloading shopify/shopify-api (v5.0.0)
  - Downloading squizlabs/php_codesniffer (3.7.2)
  - Installing brick/math (0.11.0): Extracting archive
  - Installing psr/log (2.0.0): Extracting archive
  - Installing psr/cache (3.0.0): Extracting archive
  - Installing doctrine/event-manager (2.0.0): Extracting archive
  - Installing doctrine/deprecations (v1.1.1): Extracting archive
  - Installing doctrine/cache (2.2.0): Extracting archive
  - Installing doctrine/dbal (3.6.3): Extracting archive
  - Installing doctrine/lexer (1.2.3): Extracting archive
  - Installing symfony/polyfill-ctype (v1.27.0): Extracting archive
  - Installing webmozart/assert (1.11.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.3.2): Extracting archive
  - Installing symfony/polyfill-php80 (v1.27.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.27.0): Extracting archive
  - Installing symfony/var-dumper (v5.4.24): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.27.0): Extracting archive
  - Installing symfony/string (v6.3.0): Extracting archive
  - Installing symfony/deprecation-contracts (v3.3.0): Extracting archive
  - Installing psr/container (1.1.2): Extracting archive
  - Installing symfony/service-contracts (v2.5.2): Extracting archive
  - Installing symfony/polyfill-php73 (v1.27.0): Extracting archive
  - Installing symfony/console (v5.4.24): Extracting archive
  - Installing monolog/monolog (2.9.1): Extracting archive
  - Installing voku/portable-ascii (1.6.1): Extracting archive
  - Installing phpoption/phpoption (1.9.1): Extracting archive
  - Installing graham-campbell/result-type (v1.1.1): Extracting archive
  - Installing vlucas/phpdotenv (v5.5.0): Extracting archive
  - Installing symfony/css-selector (v6.3.0): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (2.2.6): Extracting archive
  - Installing symfony/routing (v5.4.22): Extracting archive
  - Installing symfony/process (v5.4.24): Extracting archive
  - Installing symfony/polyfill-php72 (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.27.0): Extracting archive
  - Installing symfony/mime (v5.4.23): Extracting archive
  - Installing symfony/http-foundation (v5.4.24): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v3.3.0): Extracting archive
  - Installing symfony/event-dispatcher (v6.3.0): Extracting archive
  - Installing symfony/error-handler (v5.4.24): Extracting archive
  - Installing symfony/http-kernel (v5.4.24): Extracting archive
  - Installing symfony/finder (v5.4.21): Extracting archive
  - Installing symfony/polyfill-iconv (v1.27.0): Extracting archive
  - Installing egulias/email-validator (2.1.25): Extracting archive
  - Installing swiftmailer/swiftmailer (v6.3.0): Extracting archive
  - Installing ramsey/collection (2.0.0): Extracting archive
  - Installing ramsey/uuid (4.7.4): Extracting archive
  - Installing psr/simple-cache (1.0.1): Extracting archive
  - Installing opis/closure (3.6.3): Extracting archive
  - Installing symfony/translation-contracts (v3.3.0): Extracting archive
  - Installing symfony/translation (v6.3.0): Extracting archive
  - Installing nesbot/carbon (2.67.0): Extracting archive
  - Installing league/mime-type-detection (1.11.0): Extracting archive
  - Installing league/flysystem (1.1.10): Extracting archive
  - Installing nette/utils (v4.0.0): Extracting archive
  - Installing nette/schema (v1.2.3): Extracting archive
  - Installing dflydev/dot-access-data (v3.0.2): Extracting archive
  - Installing league/config (v1.2.0): Extracting archive
  - Installing league/commonmark (2.4.0): Extracting archive
  - Installing laravel/serializable-closure (v1.3.0): Extracting archive
  - Installing doctrine/inflector (2.0.6): Extracting archive
  - Installing laravel/framework (v8.83.27): Extracting archive
  - Installing facade/ignition-contracts (1.0.2): Extracting archive
  - Installing facade/flare-client-php (1.10.0): Extracting archive
  - Installing facade/ignition (2.17.7): Extracting archive
  - Installing fakerphp/faker (v1.22.0): Extracting archive
  - Installing fideloper/proxy (4.4.2): Extracting archive
  - Installing fruitcake/php-cors (v1.2.0): Extracting archive
  - Installing fruitcake/laravel-cors (v3.0.0): Extracting archive
  - Installing guzzlehttp/promises (2.0.0): Extracting archive
  - Installing symfony/yaml (v6.3.0): Extracting archive
  - Installing laravel/sail (v1.22.0): Extracting archive
  - Installing nikic/php-parser (v4.15.5): Extracting archive
  - Installing psy/psysh (v0.11.18): Extracting archive
  - Installing laravel/tinker (v2.8.1): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
  - Installing mockery/mockery (1.6.1): Extracting archive
  - Installing filp/whoops (2.15.2): Extracting archive
  - Installing nunomaduro/collision (v5.11.0): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (3.2.1): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/recursion-context (4.0.5): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.5): Extracting archive
  - Installing sebastian/exporter (4.0.5): Extracting archive
  - Installing sebastian/environment (5.1.5): Extracting archive
  - Installing sebastian/diff (4.0.5): Extracting archive
  - Installing sebastian/comparator (4.0.8): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
  - Installing theseer/tokenizer (1.2.1): Extracting archive
  - Installing sebastian/lines-of-code (1.0.3): Extracting archive
  - Installing sebastian/complexity (2.0.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.26): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.11.1): Extracting archive
  - Installing doctrine/instantiator (2.0.0): Extracting archive
  - Installing phpunit/phpunit (9.6.8): Extracting archive
  - Installing psr/http-message (1.1): Extracting archive
  - Installing psr/http-factory (1.0.2): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-client (1.0.2): Extracting archive
  - Installing guzzlehttp/psr7 (2.5.0): Extracting archive
  - Installing guzzlehttp/guzzle (7.7.0): Extracting archive
  - Installing firebase/php-jwt (v6.5.0): Extracting archive
  - Installing shopify/shopify-api (v5.0.0): Extracting archive
  - Installing squizlabs/php_codesniffer (3.7.2): Extracting archive
Package fruitcake/laravel-cors is abandoned, you should avoid using it. No replacement was suggested.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
 
In Process.php line 146:
 
  The Process class relies on proc_open, which is not available on your PHP installation.
 
 
install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [&lt;packages>...]
 
 

18、参考:Jenkins 构建镜像时,报错:The Process class relies on proc_open, which is not available on your PHP installation.的解决 。 编辑 /usr/local/php/etc/php.ini,在 disable_functions 中删除 proc_open、proc_get_status


disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen

[root@iZ23wv7v5ggZ php]# service php-fpm restart
Redirecting to /bin/systemctl restart php-fpm.service
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package fruitcake/laravel-cors is abandoned, you should avoid using it. No replacement was suggested.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/sail
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
81 packages you are using are looking for funding.
Use the `composer fund` command to find out more!



19、执行数据库迁移时失败,报错:SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes


[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# php artisan migrate
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Migration table created successfully.
Migrating: 2019_08_19_000000_create_failed_jobs_table

   Illuminate\Database\QueryException

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `failed_jobs` add unique `failed_jobs_uuid_unique`(`uuid`))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }

      +9 vendor frames
  10  database/migrations/2019_08_19_000000_create_failed_jobs_table.php:24
      Illuminate\Support\Facades\Facade::__callStatic()

      +22 vendor frames
  33  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()


20、参考:阿里云RDS的参数配置,启用Innodb_large_prefix 。编辑 config/database.php,修改 ‘engine’ => null, 为 ‘engine’ => ‘InnoDB’,。再次执行数据库迁移,报错。SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘failed_jobs’ already exists。在数据库中删除掉所有表后,重新执行迁移。不再报错。


[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# php artisan migrate
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Migration table created successfully.
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (13.03ms)
Migrating: 2021_05_03_050717_create_sessions_table
Migrated:  2021_05_03_050717_create_sessions_table (11.62ms)
Migrating: 2021_05_05_071311_add_scope_expires_access_token_to_sessions
Migrated:  2021_05_05_071311_add_scope_expires_access_token_to_sessions (9.72ms)
Migrating: 2021_05_11_151158_add_online_access_info_to_sessions
Migrated:  2021_05_11_151158_add_online_access_info_to_sessions (9.32ms)
Migrating: 2021_05_17_152611_change_sessions_user_id_type
Migrated:  2021_05_17_152611_change_sessions_user_id_type (48.28ms)



21、构建后端。


[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# composer build
> composer build-frontend-links
> ln -sf ../frontend/dist/assets public/assets &amp;&amp; ln -sf ../frontend/dist/index.html public/index.html



22、访问应用首页:https://learn-php-app-0605-prod.shuijingwanwq.com/ 。响应 403。如图6

访问应用首页:https://learn-php-app-0605-prod.shuijingwanwq.com/ 。响应 403

图6

23、查看虚拟主机配置文件


[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# cat /usr/local/nginx/conf/vhost/learn-php-app-0605-prod.shuijingwanwq.com.conf
server {
  listen 80;
  listen [::]:80;
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  ssl_certificate /usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.crt;
  ssl_certificate_key /usr/local/nginx/conf/ssl/learn-php-app-0605-prod.shuijingwanwq.com.key;
  ssl_protocols TLSv1.2 TLSv1.3;
  ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
  ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256;
  ssl_conf_command Ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256;
  ssl_conf_command Options PrioritizeChaCha;
  ssl_prefer_server_ciphers on;
  ssl_session_timeout 10m;
  ssl_session_cache shared:SSL:10m;
  ssl_buffer_size 2k;
  add_header Strict-Transport-Security max-age=15768000;
  ssl_stapling on;
  ssl_stapling_verify on;
  server_name learn-php-app-0605-prod.shuijingwanwq.com;
  access_log /data/wwwlogs/learn-php-app-0605-prod.shuijingwanwq.com_nginx.log combined;
  index index.html index.htm index.php;
  root /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com;
  if ($ssl_protocol = "") { return 301 https://$host$request_uri; }

  include /usr/local/nginx/conf/rewrite/laravel.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;
  location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
    valid_referers none blocked *.shuijingwanwq.com learn-php-app-0605-prod.shuijingwanwq.com;
    if ($invalid_referer) {
        return 403;
    }
  }
  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
    deny all;
  }
  location /.well-known {
    allow all;
  }
}
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# ^C
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]# cat /usr/local/nginx/conf/rewrite/laravel.conf
location / {
  try_files $uri $uri/ /index.php?$query_string;
}
[root@iZ23wv7v5ggZ learn-php-app-0605-prod.shuijingwanwq.com]#



24、参考模板中的 nginx.conf,其内容如下


user www-data www-data;

events {
    worker_connections 1024;
}

http {
    index index.php index.html;

    upstream php {
        server 127.0.0.1:9000;
    }

    server {
        include /etc/nginx/mime.types;
        include /etc/nginx/default.d/*.conf;

        listen PORT;
        server_name 0.0.0.0;
        root /app/public;

        location / {
            try_files $uri $uri/ /index.php?$args;
        }

        location ~ [^/]\.php(/|$) {
            include /etc/nginx/fastcgi_params;

            try_files $uri $uri/ /index.php?$uri;

            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO       $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

            fastcgi_pass   php;
            fastcgi_index  index.php;
        }
    }
}


25、编辑 /usr/local/nginx/conf/vhost/learn-php-app-0605-prod.shuijingwanwq.com.conf


  index index.php index.html;
  root /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com/public;


26、响应 500,开启 debug,编辑 .env。报错:TypeError
Shopify\Utils::sanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given, called in /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com/app/Lib/AuthRedirection.php on line 17 。不用理会,符合预期。如图7

报错:TypeErrorShopify\Utils::sanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given, called in /data/wwwroot/learn-php-app-0605-prod.shuijingwanwq.com/app/Lib/AuthRedirection.php on line 17

图7


APP_ENV=local
APP_DEBUG=true


27、更新合作伙伴仪表板中的 URL。如图8

更新合作伙伴仪表板中的 URL

图8

28、在合作伙伴仪表板中,转到应用程序的概览页面。在“测试您的应用”部分中,单击“选择商店”,然后选择一个商店来测试应用。如图9

在合作伙伴仪表板中,转到应用程序的概览页面。在“测试您的应用”部分中,单击“选择商店”,然后选择一个商店来测试应用

图9

29、安装应用时,报错:ops, something went wrong. 。原因应该在于请求参数有误。如图10

安装应用时,报错:ops, something went wrong. 。原因应该在于请求参数有误

图10


client_id: not_defined
scope: not_defined
redirect_uri: https://not_defined/api/auth/callback
state: b27be356-0010-43ae-b3b8-90a337314c0c
grant_options[]: 


30、编辑 .env,参考 .env.testing


APP_NAME="Shopify PHP App 0605 Prod"
APP_ENV=production
APP_KEY=base64:tPbLjWcISYL3Z/HS+OQS2GXvMPb0A7GlvNv6iFwFG6A=
APP_DEBUG=false
APP_URL=https://learn-php-app-0605-prod.shuijingwanwq.com

SHOPIFY_API_KEY=c7f826670575f7ae069f7e56350465ef
SHOPIFY_API_SECRET=4de64aa8281e97055cf7698bbe56039e
SCOPES=write_products
HOST=learn-php-app-0605-prod.shuijingwanwq.com

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=**************
DB_PORT=3306
DB_DATABASE=learn_php_app_0605_prod
DB_USERNAME=learn_php_app_0605_prod
DB_PASSWORD=*********



31、不再报错。如图11

不再报错

图11

32、点击安装应用后,进入店铺后台,但是页面预览为空白。如图12

点击安装应用后,进入店铺后台,但是页面预览为空白

图12

33、重新构建前端与后端后,卸载应用。如图13

重新构建前端与后端后,卸载应用

图13

34、再次安装,刷新页面,页面不再空白,符合预期。如图14

再次安装,刷新页面,页面不再空白,符合预期

图14

]]>
https://www.shuijingwanwq.com/2023/07/13/7855/feed/ 1
在阿里云 ECS 中编译安装 PHP 扩展 fileinfo 时,一直卡住的解决(提升内存配置) https://www.shuijingwanwq.com/2023/07/07/7824/ https://www.shuijingwanwq.com/2023/07/07/7824/#comments Fri, 07 Jul 2023 01:19:56 +0000 https://www.shuijingwanwq.com/?p=7824 Post Views: 125 1、在安装 PHP 扩展时,一直卡在 –php_extensions fileinfo 处。我的 ECS 内存为 1 GB 配置。编译 fileinfo 非常占用内存,这是导致无法编译的直接原因。最终决定提升 ECS 的配置,内存提升至 2 GB 。如图1
在安装 PHP 扩展时,一直卡在 --php_extensions fileinfo 处。我的 ECS 内存为 1 GB 配置。编译 fileinfo 非常占用内存,这是导致无法编译的直接原因。最终决定提升 ECS 的配置,内存提升至 2 GB

图1

<pre class="wp-block-syntaxhighlighter-code">

[root@iZ23wv7v5ggZ ~]# wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --php_option 11 --phpcache_option 1 --php_extensions imagick,redis --pureftpd  --redis
[root@iZ23wv7v5ggZ oneinstack]# ./install.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

Please input SSH port(Default: 22):

Do you want to install Web server? [y/n]: n

Do you want to install Database? [y/n]: n

Do you want to install PHP? [y/n]: n

Do you want to install opcode cache of the PHP? [y/n]: n

Please select PHP extensions:
         0. Do not install
         1. Install zendguardloader(PHP<=5.6)
         2. Install ioncube
         3. Install sourceguardian(PHP<=7.2)
         4. Install imagick
         5. Install gmagick
         6. Install fileinfo
         7. Install imap
         8. Install ldap
         9. Install phalcon(PHP>=5.5)
        10. Install yaf(PHP>=7.0)
        11. Install redis
        12. Install memcached
        13. Install memcache
        14. Install mongodb
        15. Install swoole
        16. Install xdebug(PHP>=5.5)
Please input numbers:(Default '4 11 12' press Enter) 6


</pre>
2、另外一个方案,可通过软件解决,可参考:https://help.aliyun.com/document_detail/42534.html Linux实例SWAP分区的配置和常见问题处理。 3、不过提升硬件配置,可以加快程序的运行速度,我感觉有必要付出一定的费用。资源变配。如图2
不过提升硬件配置,可以加快程序的运行速度,我感觉有必要付出一定的费用。资源变配

图2

4、选择 升级配置 ,支持对所选实例的实例规格(CPU、内存)和公网宽带进行升级,升级后新配置将覆盖实例的整个生命周期,您需要支付从当前配置到升级新配置的差价。变更操作在通过ECS实例控制台或API重启实例后生效。如图3
选择 升级配置 ,支持对所选实例的实例规格(CPU、内存)和公网宽带进行升级,升级后新配置将覆盖实例的整个生命周期,您需要支付从当前配置到升级新配置的差价。变更操作在通过ECS实例控制台或API重启实例后生效

图3

5、从 ecs.n1.tiny 升级至 ecs.n1.small。如图4
从 ecs.n1.tiny 升级至 ecs.n1.small

图4

6、配置变更成功后。再次安装 PHP 扩展 fileinfo。如图5
配置变更成功后。再次安装 PHP 扩展 fileinfo

图5



[root@iZ23wv7v5ggZ ~]# ./oneinstack/install.sh --php_extensions fileinfo

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

[php-8.1.19.tar.gz] found
Configuring for:
PHP Api Version:         20210902
Zend Module Api No:      20210902
Zend Extension Api No:   420210902
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20210902
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for fileinfo support... yes, shared
checking for strcasestr... yes
checking for utimes... yes
checking for strndup... yes
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for /bin/ld option to reload object files... -r
checking for BSD-compatible nm... /bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/apprentice.c -o libmagic/apprentice.lo  -MMD -MF libmagic/apprentice.dep -MT libmagic/apprentice.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/apprentice.c -MMD -MF libmagic/apprentice.dep -MT libmagic/apprentice.lo  -fPIC -DPIC -o libmagic/.libs/apprentice.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/apptype.c -o libmagic/apptype.lo  -MMD -MF libmagic/apptype.dep -MT libmagic/apptype.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/apptype.c -MMD -MF libmagic/apptype.dep -MT libmagic/apptype.lo  -fPIC -DPIC -o libmagic/.libs/apptype.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/ascmagic.c -o libmagic/ascmagic.lo  -MMD -MF libmagic/ascmagic.dep -MT libmagic/ascmagic.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/ascmagic.c -MMD -MF libmagic/ascmagic.dep -MT libmagic/ascmagic.lo  -fPIC -DPIC -o libmagic/.libs/ascmagic.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/cdf.c -o libmagic/cdf.lo  -MMD -MF libmagic/cdf.dep -MT libmagic/cdf.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/cdf.c -MMD -MF libmagic/cdf.dep -MT libmagic/cdf.lo  -fPIC -DPIC -o libmagic/.libs/cdf.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/cdf_time.c -o libmagic/cdf_time.lo  -MMD -MF libmagic/cdf_time.dep -MT libmagic/cdf_time.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/cdf_time.c -MMD -MF libmagic/cdf_time.dep -MT libmagic/cdf_time.lo  -fPIC -DPIC -o libmagic/.libs/cdf_time.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/compress.c -o libmagic/compress.lo  -MMD -MF libmagic/compress.dep -MT libmagic/compress.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/compress.c -MMD -MF libmagic/compress.dep -MT libmagic/compress.lo  -fPIC -DPIC -o libmagic/.libs/compress.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/encoding.c -o libmagic/encoding.lo  -MMD -MF libmagic/encoding.dep -MT libmagic/encoding.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/encoding.c -MMD -MF libmagic/encoding.dep -MT libmagic/encoding.lo  -fPIC -DPIC -o libmagic/.libs/encoding.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/fsmagic.c -o libmagic/fsmagic.lo  -MMD -MF libmagic/fsmagic.dep -MT libmagic/fsmagic.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/fsmagic.c -MMD -MF libmagic/fsmagic.dep -MT libmagic/fsmagic.lo  -fPIC -DPIC -o libmagic/.libs/fsmagic.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/funcs.c -o libmagic/funcs.lo  -MMD -MF libmagic/funcs.dep -MT libmagic/funcs.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/funcs.c -MMD -MF libmagic/funcs.dep -MT libmagic/funcs.lo  -fPIC -DPIC -o libmagic/.libs/funcs.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/is_json.c -o libmagic/is_json.lo  -MMD -MF libmagic/is_json.dep -MT libmagic/is_json.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/is_json.c -MMD -MF libmagic/is_json.dep -MT libmagic/is_json.lo  -fPIC -DPIC -o libmagic/.libs/is_json.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/is_tar.c -o libmagic/is_tar.lo  -MMD -MF libmagic/is_tar.dep -MT libmagic/is_tar.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/is_tar.c -MMD -MF libmagic/is_tar.dep -MT libmagic/is_tar.lo  -fPIC -DPIC -o libmagic/.libs/is_tar.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/magic.c -o libmagic/magic.lo  -MMD -MF libmagic/magic.dep -MT libmagic/magic.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/magic.c -MMD -MF libmagic/magic.dep -MT libmagic/magic.lo  -fPIC -DPIC -o libmagic/.libs/magic.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/print.c -o libmagic/print.lo  -MMD -MF libmagic/print.dep -MT libmagic/print.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/print.c -MMD -MF libmagic/print.dep -MT libmagic/print.lo  -fPIC -DPIC -o libmagic/.libs/print.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/readcdf.c -o libmagic/readcdf.lo  -MMD -MF libmagic/readcdf.dep -MT libmagic/readcdf.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/readcdf.c -MMD -MF libmagic/readcdf.dep -MT libmagic/readcdf.lo  -fPIC -DPIC -o libmagic/.libs/readcdf.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/softmagic.c -o libmagic/softmagic.lo  -MMD -MF libmagic/softmagic.dep -MT libmagic/softmagic.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/softmagic.c -MMD -MF libmagic/softmagic.dep -MT libmagic/softmagic.lo  -fPIC -DPIC -o libmagic/.libs/softmagic.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/der.c -o libmagic/der.lo  -MMD -MF libmagic/der.dep -MT libmagic/der.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/der.c -MMD -MF libmagic/der.dep -MT libmagic/der.lo  -fPIC -DPIC -o libmagic/.libs/der.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/buffer.c -o libmagic/buffer.lo  -MMD -MF libmagic/buffer.dep -MT libmagic/buffer.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/buffer.c -MMD -MF libmagic/buffer.dep -MT libmagic/buffer.lo  -fPIC -DPIC -o libmagic/.libs/buffer.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=compile cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g   -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/is_csv.c -o libmagic/is_csv.lo  -MMD -MF libmagic/is_csv.dep -MT libmagic/is_csv.lo
 cc -I. -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c99 -g -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic -DZEND_COMPILE_DL_EXT=1 -c /root/oneinstack/src/php-8.1.19/ext/fileinfo/libmagic/is_csv.c -MMD -MF libmagic/is_csv.dep -MT libmagic/is_csv.lo  -fPIC -DPIC -o libmagic/.libs/is_csv.o
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=link cc -shared -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/include -I/root/oneinstack/src/php-8.1.19/ext/fileinfo/main -I/root/oneinstack/src/php-8.1.19/ext/fileinfo -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c99 -g    -o fileinfo.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/oneinstack/src/php-8.1.19/ext/fileinfo/modules  fileinfo.lo libmagic/apprentice.lo libmagic/apptype.lo libmagic/ascmagic.lo libmagic/cdf.lo libmagic/cdf_time.lo libmagic/compress.lo libmagic/encoding.lo libmagic/fsmagic.lo libmagic/funcs.lo libmagic/is_json.lo libmagic/is_tar.lo libmagic/magic.lo libmagic/print.lo libmagic/readcdf.lo libmagic/softmagic.lo libmagic/der.lo libmagic/buffer.lo libmagic/is_csv.lo
cc -shared  .libs/fileinfo.o libmagic/.libs/apprentice.o libmagic/.libs/apptype.o libmagic/.libs/ascmagic.o libmagic/.libs/cdf.o libmagic/.libs/cdf_time.o libmagic/.libs/compress.o libmagic/.libs/encoding.o libmagic/.libs/fsmagic.o libmagic/.libs/funcs.o libmagic/.libs/is_json.o libmagic/.libs/is_tar.o libmagic/.libs/magic.o libmagic/.libs/print.o libmagic/.libs/readcdf.o libmagic/.libs/softmagic.o libmagic/.libs/der.o libmagic/.libs/buffer.o libmagic/.libs/is_csv.o   -Wl,-soname -Wl,fileinfo.so -o .libs/fileinfo.so
creating fileinfo.la
(cd .libs && rm -f fileinfo.la && ln -s ../fileinfo.la fileinfo.la)
/bin/sh /root/oneinstack/src/php-8.1.19/ext/fileinfo/libtool --mode=install cp ./fileinfo.la /root/oneinstack/src/php-8.1.19/ext/fileinfo/modules
cp ./.libs/fileinfo.so /root/oneinstack/src/php-8.1.19/ext/fileinfo/modules/fileinfo.so
cp ./.libs/fileinfo.lai /root/oneinstack/src/php-8.1.19/ext/fileinfo/modules/fileinfo.la
PATH="$PATH:/sbin" ldconfig -n /root/oneinstack/src/php-8.1.19/ext/fileinfo/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/oneinstack/src/php-8.1.19/ext/fileinfo/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20210902/
PHP fileinfo module installed successfully!
[xprober.php] found
####################Congratulations########################
Total OneinStack Install Time: 0 minutes



]]>
https://www.shuijingwanwq.com/2023/07/07/7824/feed/ 1
在阿里云的 ECS 中,CentOS 7 迁移(更换)至 Alibaba Cloud Linux 3 https://www.shuijingwanwq.com/2023/07/06/7805/ https://www.shuijingwanwq.com/2023/07/06/7805/#comments Thu, 06 Jul 2023 01:33:20 +0000 https://www.shuijingwanwq.com/?p=7805 Post Views: 227 1、配置 CentOS 7 yum 源,参考:《CentOS、Ubuntu、Debian依赖源配置》 。更新缓存时报错:File contains no section headers. Loaded plugins: fastestmirror 。原因在于 CentOS 停止维护。
<pre class="wp-block-syntaxhighlighter-code">

[root@iZ23wv7v5ggZ ~]# cd /etc/yum.repos.d/
[root@iZ23wv7v5ggZ yum.repos.d]# ls -l
total 8
-rw-r--r-- 1 root root 2523 Jan 28  2022 CentOS-Base.repo
-rw-r--r-- 1 root root  664 Jan 28  2022 epel.repo
[root@iZ23wv7v5ggZ yum.repos.d]# rm -rf /etc/yum.repos.d/*.repo
[root@iZ23wv7v5ggZ yum.repos.d]# ls -l
total 0
[root@iZ23wv7v5ggZ yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7221  100  7221    0     0   3763      0  0:00:01  0:00:01 --:--:--  3762
[root@iZ23wv7v5ggZ yum.repos.d]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7215  100  7215    0     0  11531      0 --:--:-- --:--:-- --:--:-- 11525
[root@iZ23wv7v5ggZ yum.repos.d]# yum makecache
Loaded plugins: fastestmirror


File contains no section headers.
file: file:///etc/yum.repos.d/CentOS-Base.repo, line: 1
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n'
[root@iZ23wv7v5ggZ yum.repos.d]# ls -l
total 16
-rw-r--r-- 1 root root 7221 Jun  6 14:32 CentOS-Base.repo
-rw-r--r-- 1 root root 7215 Jun  6 14:32 epel.repo
[root@iZ23wv7v5ggZ yum.repos.d]#


</pre>
2、参考:阿里云针对CentOS EOL迁移方案 。准备将现在使用的CentOS迁移到Alibaba Cloud Linux操作系统。 3、在迁移前为ECS实例创建快照备份数据,避免操作过程中导致数据丢失。如图1
在迁移前为ECS实例创建快照备份数据,避免操作过程中导致数据丢失

图1

4、CentOS 7迁移Alibaba Cloud Linux 2详细迁移步骤,请参见 CentOS 7迁移Alibaba Cloud Linux 2 5、停止 ECS 实例。如图2
停止 ECS 实例

图2

6、登录ECS管理控制台。找到目标实例,在操作列选择更多 > 云盘和镜像 > 更换操作系统。如图3
登录ECS管理控制台。找到目标实例,在操作列选择更多 > 云盘和镜像 > 更换操作系统

图3

7、没有操作系统迁移的选项,需要切换至新版本的控制台。如图4
没有操作系统迁移的选项,需要切换至新版本的控制台

图4

8、在操作列选择更多 > 云盘和镜像 > 更换操作系统。如图5
在操作列选择更多 > 云盘和镜像 > 更换操作系统

图5

9、在更换操作系统对话框,选中操作系统迁移。如图6
在更换操作系统对话框,选中操作系统迁移

图6

10、目标操作系统,选择 Alibaba Cloud Linux 3 停止支持日期:2031年4月30日。如图7
目标操作系统,选择 Alibaba Cloud Linux 3 停止支持日期:2031年4月30日

图7

11、状态显示为系统更换中。更换失败,已停止 普通停机模式。如图8
状态显示为系统更换中。更换失败,已停止 普通停机模式

图8

12、服务器迁移中心 SMC,导入迁移源。如图9
服务器迁移中心 SMC,导入迁移源

图9

13、不可导入 原因:选中的实例不可执行云助手命令,请检查当前实例云助手状态。如图10
不可导入 原因:选中的实例不可执行云助手命令,请检查当前实例云助手状态

图10

14、启动实例后,再次导入迁移源。迁移源状态:导入中。如图11
启动实例后,再次导入迁移源。迁移源状态:导入中

图11

15、导入异常。删除后,重新导入。仍然报错:错误码:SourceServer.ImportError 错误信息: 导入超时。如图12
导入异常。删除后,重新导入。仍然报错:错误码:SourceServer.ImportError 错误信息: 导入超时

图12

16、删除后,停止实例,目标操作系统,选择 Anolis OS 7 停止支持日期:2024年6月30日。如图13
删除后,停止实例,目标操作系统,选择 Anolis OS 7 停止支持日期:2024年6月30日

图13

17、最后发现 操作系统迁移 下的 4 个目标系统,皆迁移失败。 18、现阶段唯一的办法只剩下更换系统盘选项了,然后重新部署相关环境。如图14
现阶段唯一的办法只剩下更换系统盘选项了,然后重新部署相关环境

图14

19、选择镜像:Alibaba Cloud Linux , 3.2104 LTS 64位。如图15
选择镜像:Alibaba Cloud Linux , 3.2104 LTS 64位

图15

20、如果更换操作系统前后都是Linux系统且数据盘设置了开机自动挂载分区。切换操作系统后,数据盘分区挂载信息会丢失,需要更新/etc/fstab配置。具体操作,请参见 在fstab文件中配置UUID方式自动挂载数据盘。运行以下命令检查挂载结果


[root@iZ23wv7v5ggZ ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        464M     0  464M   0% /dev
tmpfs           482M     0  482M   0% /dev/shm
tmpfs           482M  440K  481M   1% /run
tmpfs           482M     0  482M   0% /sys/fs/cgroup
/dev/vda1        20G  2.9G   16G  16% /
tmpfs           482M     0  482M   0% /tmp
tmpfs            97M     0   97M   0% /run/user/0



21、运行以下命令查看实例的云盘信息


[root@iZ23wv7v5ggZ ~]#  fdisk -lu
Disk /dev/vda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x51cf5d51

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 41943039 41940992  20G 83 Linux


Disk /dev/vdb: 40 GiB, 42949672960 bytes, 83886080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc0ac4089

Device     Boot Start      End  Sectors Size Id Type
/dev/vdb1        2048 83886079 83884032  40G 83 Linux
[root@iZ23wv7v5ggZ ~]#



22、运行以下命令查询云盘的UUID信息。


[root@iZ23wv7v5ggZ ~]# blkid
/dev/vda1: UUID="3bda0135-1a08-4c3e-8216-e07c05dd073a" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="51cf5d51-01"
/dev/vdb1: UUID="0feecc5e-62d8-4282-98b3-cdc8ecf51952" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="c0ac4089-01"
[root@iZ23wv7v5ggZ ~]#



23、运行以下命令分别创建数据盘的挂载点。创建 /dev/vdb1 的挂载点 /data


[root@iZ23wv7v5ggZ /]# mkdir /data



24、在fstab文件中添加挂载信息。运行以下命令编辑 fstab。新增以下挂载信息。结果如下所示。如图16



[root@iZ23wv7v5ggZ /]# vi /etc/fstab
[root@iZ23wv7v5ggZ /]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu May 25 04:02:20 2023
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=3bda0135-1a08-4c3e-8216-e07c05dd073a /                       ext4    defaults        1 1
UUID=0feecc5e-62d8-4282-98b3-cdc8ecf51952   /data     ext4    defaults     0   0
[root@iZ23wv7v5ggZ /]#




25、运行以下命令挂载数据盘分区的文件系统。挂载 /dev/vdb1


[root@iZ23wv7v5ggZ /]# mount /dev/vdb1 /data


26、运行以下命令检查挂载结果。



[root@iZ23wv7v5ggZ /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        464M     0  464M   0% /dev
tmpfs           482M     0  482M   0% /dev/shm
tmpfs           482M  440K  481M   1% /run
tmpfs           482M     0  482M   0% /sys/fs/cgroup
/dev/vda1        20G  2.9G   16G  16% /
tmpfs           482M     0  482M   0% /tmp
tmpfs            97M     0   97M   0% /run/user/0
/dev/vdb1        40G   24G   14G  65% /data
[root@iZ23wv7v5ggZ /]#



27、配置完成后,重启ECS实例,再次检查挂载结果,系统将自动挂载数据盘。


[root@iZ23wv7v5ggZ ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        464M     0  464M   0% /dev
tmpfs           482M     0  482M   0% /dev/shm
tmpfs           482M  436K  481M   1% /run
tmpfs           482M     0  482M   0% /sys/fs/cgroup
/dev/vda1        20G  2.9G   16G  16% /
tmpfs           482M     0  482M   0% /tmp
/dev/vdb1        40G   24G   14G  65% /data
tmpfs            97M     0   97M   0% /run/user/0
[root@iZ23wv7v5ggZ ~]#



28、进入 /etc/yum.repos.d/ 目录,查看 yum 源,符合预期



[root@iZ23wv7v5ggZ ~]# cd /etc/yum.repos.d/
[root@iZ23wv7v5ggZ yum.repos.d]# ls -l
total 20
-rw-r--r-- 1 root root 1475 May 25 12:15 AliYun.repo
-rw-r--r-- 1 root root  703 Jun 10  2022 epel-modular.repo
-rw-r--r-- 1 root root  664 Jun 10  2022 epel.repo
-rw-r--r-- 1 root root  781 Jun 10  2022 epel-testing-modular.repo
-rw-r--r-- 1 root root  742 Jun 10  2022 epel-testing.repo
[root@iZ23wv7v5ggZ yum.repos.d]#



]]>
https://www.shuijingwanwq.com/2023/07/06/7805/feed/ 4
在阿里云 ECS 中安装云监控插件,以确认云盘使用率,确定是否需要扩容 https://www.shuijingwanwq.com/2022/02/24/6023/ https://www.shuijingwanwq.com/2022/02/24/6023/#respond Thu, 24 Feb 2022 01:13:45 +0000 https://www.shuijingwanwq.com/?p=6023 Post Views: 84

1、在阿里云 ECS 中查看监控相关数据,部分没有数据的监控图表,需要安装监控插件之后才能看到。如图1

在阿里云 ECS 中查看监控相关数据,部分没有数据的监控图表,需要安装监控插件之后才能看到

图1

2、点击安装插件,安装云监控插件,安装插件的过程需要1-2分钟,请稍后查看。如图2

点击安装插件,安装云监控插件,安装插件的过程需要1-2分钟,请稍后查看

图2

3、等待几分钟后,已可查看云盘使用率/Inode使用率。点击查看更多指标。查看磁盘监控指标。/dev/vda1 为系统盘,/dev/vdb1 为数据盘。磁盘使用量(bytes) 的 (Agent)disk.usage.used_device—Average 表示:磁盘使用量的平均使用情况。/dev/vda1 已经使用了 11 GB。/dev/vdb1 已经使用了 17 GB。如图3

等待几分钟后,已可查看云盘使用率/Inode使用率。点击查看更多指标。查看磁盘监控指标。/dev/vda1 为系统盘,/dev/vdb1 为数据盘。磁盘使用量(bytes) 的 (Agent)disk.usage.used_device—Average 表示:磁盘使用量的平均使用情况。/dev/vda1 已经使用了 11 GB。/dev/vdb1 已经使用了 17 GB

图3

4、在阿里云 ECS 中查看云盘相关,/dev/vda1 为系统盘,为SSD云盘,其大小为 20 GB。/dev/vdb1 为数据盘,为普通云盘,其大小为 40GB。由此得出磁盘的使用率分别为:11 GB / 20 GB = 55%,17 GB / 40 GB = 43%。暂时还无需扩容。如图4

在阿里云 ECS 中查看云盘相关,/dev/vda1 为系统盘,为SSD云盘,其大小为 20 GB。/dev/vdb1 为数据盘,为普通云盘,其大小为 40GB。由此得出磁盘的使用率分别为:11 GB / 20 GB = 55%,17 GB / 40 GB = 43%。暂时还无需扩容

图4

]]>
https://www.shuijingwanwq.com/2022/02/24/6023/feed/ 0
Laravel 8.x(LaraBBS) 部署至 阿里云 ECS,基于 MySQL、Redis、Supervisor、Crontab 实现 https://www.shuijingwanwq.com/2022/01/28/5867/ https://www.shuijingwanwq.com/2022/01/28/5867/#respond Fri, 28 Jan 2022 09:14:42 +0000 https://www.shuijingwanwq.com/?p=5867 Post Views: 210 1、Laravel 8.x(LaraBBS) 在本地开发环境已经实现。如图1
Laravel 8.x(LaraBBS) 在本地开发环境已经实现

图1

2、基于 Xshell 7,登录至 阿里云 ECS。查看操作系统版本。列出所有版本信息,执行命令:lsb_release -a。版本:CentOS 7.7。如图2
基于 Xshell 7,登录至 阿里云 ECS。查看操作系统版本。列出所有版本信息,执行命令:lsb_release -a。版本:CentOS 7.7

图2



[root@iZ23wv7v5ggZ ~]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.7.1908 (Core)
Release:	7.7.1908
Codename:	Core



3、参考网址:https://oneinstack.com/ ,基于 OneinStack 来部署。由于此 ECS 中之前已经基于 OneinStack 部署过网站。因此,一些步骤会跳过。事先将云盘创建快照备份,以防万一造成数据损失。如图3
参考网址:https://oneinstack.com/ ,基于 OneinStack 来部署。由于此 ECS 中之前已经基于 OneinStack 部署过网站。因此,一些步骤会跳过。事先将云盘创建快照备份,以防万一造成数据损失

图3

4、建议在快照进度等于 100%,即状态成功后,才开始操作 ECS。如图4
建议在快照进度等于 100%,即状态成功后,才开始操作 ECS

图4

5、在 ECS 上已经部署成功的网址:https://www.shuijingwanwq.com/ 。参考网址:https://www.shuijingwanwq.com/2016/04/25/1050/ 6、目录:/root/oneinstack 早已经存在。如图5
目录:/root/oneinstack 早已经存在

图5

7、查看当前的 PHP 版本:7.4。如图6
查看当前的 PHP 版本:7.4

图6



[root@iZ23wv7v5ggZ oneinstack]# php -v
PHP 7.4.0 (cli) (built: Dec  5 2019 11:56:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies


8、升级脚本工具,不影响正在运行环境。执行命令:/upgrade.sh –oneinstack。如图7
升级脚本工具,不影响正在运行环境。执行命令:/upgrade.sh --oneinstack。

图7



[root@iZ23wv7v5ggZ oneinstack]# ./upgrade.sh --oneinstack

#######################################################################
#       OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+      #
#              Upgrade Software versions for OneinStack               #
#       For more information please visit https://oneinstack.com      #
#######################################################################

Congratulations! OneinStack upgrade successful! 

[root@iZ23wv7v5ggZ oneinstack]# 



9、参考网址:https://oneinstack.com/install/ ,添加虚拟主机,执行命令:./vhost.sh。报错:Error: Create Let’s Encrypt SSL Certificate failed! 。原因在于不存在相应的 DNS 记录。如图8
参考网址:https://oneinstack.com/install/ ,添加虚拟主机,执行命令:./vhost.sh。报错:Error: Create Let's Encrypt SSL Certificate failed! 。原因在于不存在相应的 DNS 记录

图8



[root@iZ23wv7v5ggZ oneinstack]# ./vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
	1. Use HTTP Only
	2. Use your own SSL Certificate and Key
	3. Use Let's Encrypt to Create SSL Certificate and Key
	q. Exit
Please input the correct option: 3

Please input domain(example: www.example.com): app-wangqiang-larabbs.shuijingwanwq.com
domain=app-wangqiang-larabbs.shuijingwanwq.com

Please input the directory for the domain:app-wangqiang-larabbs.shuijingwanwq.com :
(Default directory: /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com): 
Virtual Host Directory=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com

Create Virtul Host directory......
set permissions of Virtual Host directory......

Do you want to add more domain name? [y/n]: n

Do you want to redirect all HTTP requests to HTTPS? [y/n]: y

Please enter your email: shuijingwanwq@163.com

[Fri Jan  7 10:36:05 CST 2022] Unknown parameter : -m

Let's Encrypt Verify error! DNS problem: NXDOMAIN looking up A for app-wangqiang-larabbs.shuijingwanwq.com
[Fri Jan  7 10:36:10 CST 2022] Creating domain key
[Fri Jan  7 10:36:10 CST 2022] The domain key is here: /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/app-wangqiang-larabbs.shuijingwanwq.com.key
[Fri Jan  7 10:36:10 CST 2022] Single domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan  7 10:36:10 CST 2022] Getting domain auth token for each domain
[Fri Jan  7 10:36:14 CST 2022] Getting webroot for domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan  7 10:36:15 CST 2022] Verifying: app-wangqiang-larabbs.shuijingwanwq.com
[Fri Jan  7 10:36:19 CST 2022] app-wangqiang-larabbs.shuijingwanwq.com:Verify error:DNS problem: NXDOMAIN looking up A for app-wangqiang-larabbs.shuijingwanwq.com - check that a DNS record exists for this domain
[Fri Jan  7 10:36:19 CST 2022] Please add '--debug' or '--log' to check more details.
[Fri Jan  7 10:36:19 CST 2022] See: https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh
Error: Create Let's Encrypt SSL Certificate failed! 
[root@iZ23wv7v5ggZ oneinstack]# 



10、检查此域是否存在 DNS 记录。先在 DNS 中添加相应的域名:app-wangqiang-larabbs.shuijingwanwq.com 。如图9
检查此域是否存在 DNS 记录。先在 DNS 中添加相应的域名:app-wangqiang-larabbs.shuijingwanwq.com

图9

11、再次执行命令:./vhost.sh。添加虚拟主机成功。如图10
再次执行命令:./vhost.sh。添加虚拟主机成功

图10



[root@iZ23wv7v5ggZ oneinstack]# ./vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
	1. Use HTTP Only
	2. Use your own SSL Certificate and Key
	3. Use Let's Encrypt to Create SSL Certificate and Key
	q. Exit
Please input the correct option: 3

Please input domain(example: www.example.com): app-wangqiang-larabbs.shuijingwanwq.com
domain=app-wangqiang-larabbs.shuijingwanwq.com

Please input the directory for the domain:app-wangqiang-larabbs.shuijingwanwq.com :
(Default directory: /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com): 
Virtual Host Directory=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com

Create Virtul Host directory......
set permissions of Virtual Host directory......

Do you want to add more domain name? [y/n]: n

Do you want to redirect all HTTP requests to HTTPS? [y/n]: y

Please enter your email: shuijingwanwq@163.com

[Fri Jan  7 10:48:20 CST 2022] Unknown parameter : -m
[Fri Jan  7 10:48:24 CST 2022] Single domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan  7 10:48:24 CST 2022] Getting domain auth token for each domain
[Fri Jan  7 10:48:29 CST 2022] Getting webroot for domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan  7 10:48:29 CST 2022] Verifying: app-wangqiang-larabbs.shuijingwanwq.com
[Fri Jan  7 10:48:34 CST 2022] Success
[Fri Jan  7 10:48:34 CST 2022] Verify finished, start to sign.
[Fri Jan  7 10:48:34 CST 2022] Lets finalize the order, Le_OrderFinalize: https://acme-v02.api.letsencrypt.org/acme/finalize/73156074/53280741960
[Fri Jan  7 10:48:37 CST 2022] Download cert, Le_LinkCert: https://acme-v02.api.letsencrypt.org/acme/cert/04ed99c0b6706b74ad4a5a19389500b0add1
[Fri Jan  7 10:48:38 CST 2022] Cert success.
-----BEGIN CERTIFICATE-----
xxxxxxxxxx
-----END CERTIFICATE-----
[Fri Jan  7 10:48:38 CST 2022] Your cert is in  /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/app-wangqiang-larabbs.shuijingwanwq.com.cer 
[Fri Jan  7 10:48:38 CST 2022] Your cert key is in  /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/app-wangqiang-larabbs.shuijingwanwq.com.key 
[Fri Jan  7 10:48:39 CST 2022] The intermediate CA cert is in  /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/ca.cer 
[Fri Jan  7 10:48:39 CST 2022] And the full chain certs is there:  /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/fullchain.cer 

Do you want to add hotlink protection? [y/n]: y

Allow Rewrite rule? [y/n]: y

Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog,whmcs rewrite was exist.
(Default rewrite: other): laravel
You choose rewrite=laravel

Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
You access log file=/data/wwwlogs/app-wangqiang-larabbs.shuijingwanwq.com_nginx.log

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################
Your domain:                  app-wangqiang-larabbs.shuijingwanwq.com
Virtualhost conf:             /usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf
Directory of:                 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
Rewrite rule:                 /usr/local/nginx/conf/rewrite/laravel.conf
Let's Encrypt SSL Certificate:/usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.crt
SSL Private Key:              /usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.key
[root@iZ23wv7v5ggZ oneinstack]# ^C
[root@iZ23wv7v5ggZ oneinstack]# 



12、管理FTP账号,执行命令:./pureftpd_vhost.sh 。如图11
管理FTP账号,执行命令:./pureftpd_vhost.sh

图11



[root@iZ23wv7v5ggZ oneinstack]# ./pureftpd_vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+      #
#                 FTP virtual user account management                 #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
	1. UserAdd
	2. UserMod
	3. UserPasswd
	4. UserDel
	5. ListAllUser
	6. ShowUser
	q. Exit
Please input the correct option: 1

Please input a username: app-wangqiang-larabbs.shuijingwanwq.com

Please input the password: s0etwJ9DGm3e6CwP

Please input the directory(Default directory: /data/wwwroot): /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
Password: 
Enter it again: 
#####################################

[app-wangqiang-larabbs.shuijingwanwq.com] create successful! 

You user name is : app-wangqiang-larabbs.shuijingwanwq.com
You Password is : xxxxxxxxxx
You directory is : /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com


What Are You Doing?
	1. UserAdd
	2. UserMod
	3. UserPasswd
	4. UserDel
	5. ListAllUser
	6. ShowUser
	q. Exit
Please input the correct option: q
[root@iZ23wv7v5ggZ oneinstack]# 



13、打开 FlashFXP,通过 FTP 上传源代码至 目录:/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com 。如图12
打开 FlashFXP,通过 FTP 上传源代码至 目录:/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com

图12

14、登录阿里云 RDS 控制台,创建数据库:app_wangqiang_larabbs,且授权帐号:app_wangqiang_larabbs。如图13
登录阿里云 RDS 控制台,创建数据库:app_wangqiang_larabbs,且授权帐号:app_wangqiang_larabbs

图13

15、登录 RDS 实例后,已经存在数据库:app_wangqiang_larabbs。如图14
登录 RDS 实例后,已经存在数据库:app_wangqiang_larabbs

图14

16、编辑虚拟主机配置文件:/usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf 。网站根目录添加 /public。然后重启 Nginx 服务,执行命令:service nginx restart。如图15
编辑虚拟主机配置文件:/usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf 。网站根目录添加 /public。然后重启 Nginx 服务,执行命令:service nginx restart

图15



[root@iZ23wv7v5ggZ oneinstack]# cat /usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf
server {
  listen 80;
  listen 443 ssl http2;
  ssl_certificate /usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.crt;
  ssl_certificate_key /usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  ssl_prefer_server_ciphers on;
  ssl_session_timeout 10m;
  ssl_session_cache builtin:1000 shared:SSL:10m;
  ssl_buffer_size 1400;
  add_header Strict-Transport-Security max-age=15768000;
  ssl_stapling on;
  ssl_stapling_verify on;
  server_name app-wangqiang-larabbs.shuijingwanwq.com;
  access_log /data/wwwlogs/app-wangqiang-larabbs.shuijingwanwq.com_nginx.log combined;
  index index.html index.htm index.php;
  root /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/public;
  if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
  
  include /usr/local/nginx/conf/rewrite/laravel.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;
  location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
    valid_referers none blocked *.shuijingwanwq.com app-wangqiang-larabbs.shuijingwanwq.com;
    if ($invalid_referer) {
        return 403;
    }
  }
  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
    deny all;
  }
  location /.well-known {
    allow all;
  }
}
[root@iZ23wv7v5ggZ oneinstack]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service



17、查看 Laravel 的伪静态配置文件,/usr/local/nginx/conf/rewrite/laravel.conf


[root@iZ23wv7v5ggZ oneinstack]# cat /usr/local/nginx/conf/rewrite/laravel.conf
location / {
  try_files $uri $uri/ /index.php?$query_string;
}
[root@iZ23wv7v5ggZ oneinstack]# 


18、第 13 步骤完成后,设置 Laravel 目录权限。参考网址:https://learnku.com/laravel/t/62112 。www 是我的 web 服务的 用户与用户组。目录设置为 755,所有的文件设置为 644。权限方面,已经被 OneinStack 自动设置好了的。因此,像目录:/bootstrap/cache、/storage、/public/uploads,皆无需要再设置额外的权限。如图16
第 13 步骤完成后,设置 Laravel 目录权限。参考网址:https://learnku.com/laravel/t/62112 。www 是我的 web 服务的 用户与用户组。目录设置为 755,所有的文件设置为 644。权限方面,已经被 OneinStack 自动设置好了的。因此,像目录:/bootstrap/cache、/storage、/public/uploads,皆无需要再设置额外的权限

图16

19、在 ECS 中编辑文件 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/.env。 20、执行数据库迁移与填充,执行成功。如图17
执行数据库迁移与填充,执行成功

图17



[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan migrate:refresh --seed
Migration table not found.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (47.50ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (29.91ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (36.63ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (40.31ms)
Migrating: 2021_12_31_134920_add_avatar_and_introduction_to_users_table
Migrated:  2021_12_31_134920_add_avatar_and_introduction_to_users_table (240.63ms)
Migrating: 2021_12_31_155234_create_categories_table
Migrated:  2021_12_31_155234_create_categories_table (37.03ms)
Migrating: 2021_12_31_155935_seed_categories_data
Migrated:  2021_12_31_155935_seed_categories_data (12.72ms)
Migrating: 2021_12_31_161159_create_topics_table
Migrated:  2021_12_31_161159_create_topics_table (62.53ms)
Migrating: 2022_01_04_175444_create_replies_table
Migrated:  2022_01_04_175444_create_replies_table (49.36ms)
Migrating: 2022_01_05_101230_create_notifications_table
Migrated:  2022_01_05_101230_create_notifications_table (72.61ms)
Migrating: 2022_01_05_101456_add_notification_count_to_users_table
Migrated:  2022_01_05_101456_add_notification_count_to_users_table (41.74ms)
Migrating: 2022_01_05_114704_create_permission_tables
Migrated:  2022_01_05_114704_create_permission_tables (462.25ms)
Migrating: 2022_01_05_115758_seed_roles_and_permissions_data
Migrated:  2022_01_05_115758_seed_roles_and_permissions_data (252.50ms)
Migrating: 2022_01_05_164147_create_links_table
Migrated:  2022_01_05_164147_create_links_table (40.32ms)
Migrating: 2022_01_05_170327_add_references
Migrated:  2022_01_05_170327_add_references (133.90ms)
Migrating: 2022_01_06_094656_add_last_actived_at_to_users_table
Migrated:  2022_01_06_094656_add_last_actived_at_to_users_table (25.63ms)
Seeding: Database\Seeders\UsersTableSeeder
Seeded:  Database\Seeders\UsersTableSeeder (188.79ms)
Seeding: Database\Seeders\TopicsTableSeeder
Seeded:  Database\Seeders\TopicsTableSeeder (1,517.44ms)
Seeding: Database\Seeders\RepliesTableSeeder
Seeded:  Database\Seeders\RepliesTableSeeder (4,513.18ms)
Seeding: Database\Seeders\LinksTableSeeder
Seeded:  Database\Seeders\LinksTableSeeder (25.96ms)
Database seeding completed successfully.
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# 



21、打开网址:https://app-wangqiang-larabbs.shuijingwanwq.com/ ,提示:InvalidArgumentException No hint path defined for [sudosu]. 。如图18
打开网址:https://app-wangqiang-larabbs.shuijingwanwq.com/ ,提示:InvalidArgumentException No hint path defined for [sudosu].

图18

22、编辑文件 config/sudosu.php ,添加 com


    'allowed_tlds' => ['dev', 'local', 'com'],


23、在命令行启动队列系统,报错:Symfony\Component\Process\Exception\LogicException 。 The Process class relies on proc_open, which is not available on your PHP installation.。如图19
在命令行启动队列系统,报错:Symfony\Component\Process\Exception\LogicException 。  The Process class relies on proc_open, which is not available on your PHP installation.

图19



[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan queue:listen

   Symfony\Component\Process\Exception\LogicException 

  The Process class relies on proc_open, which is not available on your PHP installation.

  at vendor/symfony/process/Process.php:146
    142▕      */
    143▕     public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
    144▕     {
    145▕         if (!\function_exists('proc_open')) {
  ➜ 146▕             throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
    147▕         }
    148▕ 
    149▕         $this->commandline = $command;
    150▕         $this->cwd = $cwd;

      +16 vendor frames 
  17  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()



24、编辑 /usr/local/php/etc/php.ini 文件,搜索 disable_functions,将其值中的 proc_open 、proc_get_status 删除掉。然后重启 PHP 服务 。如图20
编辑 /usr/local/php/etc/php.ini 文件,搜索 disable_functions,将其值中的 proc_open 、proc_get_status 删除掉。然后重启 PHP 服务

图20



[root@iZ23wv7v5ggZ etc]# vi php.ini
[root@iZ23wv7v5ggZ etc]# 
[root@iZ23wv7v5ggZ etc]# service php-fpm restart
Redirecting to /bin/systemctl restart php-fpm.service
[root@iZ23wv7v5ggZ etc]# 



25、在命令行启动队列系统,队列在启动完成后会进入监听状态。但是,仍然报错: Symfony\Component\Process\Exception\ProcessTimedOutException 。 The process “‘/usr/local/php/bin/php’ ‘artisan’ ‘queue:work’ ‘–once’ ‘–name=default’ ‘–queue=default’ ‘–backoff=0’ ‘–memory=128’ ‘–sleep=3’ ‘–tries=1′” exceeded the timeout of 60 seconds.。添加选项 –timeout=0,不再报错。如图21
在命令行启动队列系统,队列在启动完成后会进入监听状态。但是,仍然报错: Symfony\Component\Process\Exception\ProcessTimedOutException 。  The process "'/usr/local/php/bin/php' 'artisan' 'queue:work' '--once' '--name=default' '--queue=default' '--backoff=0' '--memory=128' '--sleep=3' '--tries=1'" exceeded the timeout of 60 seconds.。添加选项 --timeout=0,不再报错

图21

<pre class="wp-block-syntaxhighlighter-code">

[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan queue:listen
[2022-01-07 17:04:21][9iy9L39pxxNvZ7NL9YQ0xQMXxI4EwI0j] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:22][9iy9L39pxxNvZ7NL9YQ0xQMXxI4EwI0j] Failed:     App\Jobs\TranslateSlug
[2022-01-07 17:04:23][oho1xFRRasdVKHL8f4T19vz51vwzf241] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:24][oho1xFRRasdVKHL8f4T19vz51vwzf241] Failed:     App\Jobs\TranslateSlug
[2022-01-07 17:04:25][qCqFpPSu9ImA0JggR4IiMlIKLWL3EB8H] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:28][qCqFpPSu9ImA0JggR4IiMlIKLWL3EB8H] Failed:     App\Jobs\TranslateSlug
[2022-01-07 17:04:28][uxRYiXpFXEXBvpPxJTDKIDkCCXAgBTG9] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:29][uxRYiXpFXEXBvpPxJTDKIDkCCXAgBTG9] Failed:     App\Jobs\TranslateSlug
[2022-01-07 17:04:29][kgqbausYzFSzLYgjlAvvXfrgVaGBwZME] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:29][kgqbausYzFSzLYgjlAvvXfrgVaGBwZME] Failed:     App\Jobs\TranslateSlug
[2022-01-07 17:04:30][wdweaoBl2V2k0iCCwynnjE3imiHxmUZK] Processing: App\Jobs\TranslateSlug

   Symfony\Component\Process\Exception\ProcessTimedOutException 

  The process "'/usr/local/php/bin/php' 'artisan' 'queue:work' '--once' '--name=default' '--queue=default' '--backoff=0' '--memory=128' '--sleep=3' '--tries=1'" exceeded the timeout of 60 seconds.

  at vendor/symfony/process/Process.php:1204
    1200▕ 
    1201▕         if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
    1202▕             $this->stop(0);
    1203▕ 
  ➜ 1204▕             throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
    1205▕         }
    1206▕ 
    1207▕         if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
    1208▕             $this->stop(0);

      +18 vendor frames 
  19  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan queue:listen --timeout=0
[2022-01-07 17:08:38][crCkj0LVPcowMiTlvjeGcGNHkPh1E4rY] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:39][crCkj0LVPcowMiTlvjeGcGNHkPh1E4rY] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:40][a6UvDyYukqW1sUSNcbjw7P6QzpFnt1dU] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:42][a6UvDyYukqW1sUSNcbjw7P6QzpFnt1dU] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:43][m8I0VIyZL9TguYR0XnxINv72wLgXqDCv] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:43][m8I0VIyZL9TguYR0XnxINv72wLgXqDCv] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:44][NM3oLDGUOhcsT5cIy9tAiM4WR1kOHTDw] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:46][NM3oLDGUOhcsT5cIy9tAiM4WR1kOHTDw] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:46][AGlsFITpj9Aqy2Iu0SOJZoxyNYcTl7ax] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:47][AGlsFITpj9Aqy2Iu0SOJZoxyNYcTl7ax] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:48][F8UO802DJzIt6nrIfAd5KZU0SmrFWg60] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:49][F8UO802DJzIt6nrIfAd5KZU0SmrFWg60] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:49][uN38Doj9q9xwDWtQcU7dGZLOub3W9Sqg] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:50][uN38Doj9q9xwDWtQcU7dGZLOub3W9Sqg] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:50][i2Fpvio1WVFbCbVFwmM8F6Gm9FWgveYq] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:51][i2Fpvio1WVFbCbVFwmM8F6Gm9FWgveYq] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:52][Ac7q3FzkUum0PN6jMVWYCqbbXRfInRM3] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:52][Ac7q3FzkUum0PN6jMVWYCqbbXRfInRM3] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:53][JstjmnEAp5ttbdPyqLXri7SwMs8Q7ple] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:54][JstjmnEAp5ttbdPyqLXri7SwMs8Q7ple] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:55][k7n2iJdSelQcgQWXsrjyci4KG1vNsAlq] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:55][k7n2iJdSelQcgQWXsrjyci4KG1vNsAlq] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:56][LcSujDiTXczEUgE1YZ5Cwf459he4yxSD] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:57][LcSujDiTXczEUgE1YZ5Cwf459he4yxSD] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:57][t2Umbs1fLco6N4ZfjYkEEbMdEHje0r9d] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:59][t2Umbs1fLco6N4ZfjYkEEbMdEHje0r9d] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:08:59][m4ttqh4axQ6JpFPQoL6Skpa1qBPAB6EC] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:01][m4ttqh4axQ6JpFPQoL6Skpa1qBPAB6EC] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:01][ARlo5v4zTyv3RUyKlBiR6HiYiwtuY6r5] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:03][ARlo5v4zTyv3RUyKlBiR6HiYiwtuY6r5] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:03][0DAnnrmFlwmZ6u1DGpZT0lL3fVc2GoTP] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:05][0DAnnrmFlwmZ6u1DGpZT0lL3fVc2GoTP] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:05][RXGEod7NPKnjrvzp0LB0xG7tumOTZQB3] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:07][RXGEod7NPKnjrvzp0LB0xG7tumOTZQB3] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:08][ebi2yS5WyyaZgfdHHdM0bPr6voETTHOY] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:10][ebi2yS5WyyaZgfdHHdM0bPr6voETTHOY] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:10][oCUs3UGYliYMEIldq3bOvbXEAuHJxH74] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:11][oCUs3UGYliYMEIldq3bOvbXEAuHJxH74] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:12][qS3aEkUuUx7s9eekD6txazQFCGXdZf95] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:12][qS3aEkUuUx7s9eekD6txazQFCGXdZf95] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:13][0M5eGoCrf44T0bHqi6CSnJWhIcRScx7V] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:13][0M5eGoCrf44T0bHqi6CSnJWhIcRScx7V] Processed:  App\Jobs\TranslateSlug
[2022-01-07 17:09:14][ILzNa3JxWqzi4hMEbKsywvspJR0cSG7V] Processing: App\Jobs\TranslateSlug
^C
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# 


</pre>
26、发现队列作业未按预期起作用,查看表:failed_jobs,里面存在一些失败的队列记录。可以忽略掉,因为这是偶发事件,应该是一瞬间的调用频率过高所导致。如图22
发现队列作业未按预期起作用,查看表:failed_jobs,里面存在一些失败的队列记录。可以忽略掉,因为这是偶发事件,应该是一瞬间的调用频率过高所导致

图22

<pre class="wp-block-syntaxhighlighter-code">

GuzzleHttp\Exception\ServerException: Server error: `GET http://api.fanyi.baidu.com/api/trans/vip/translate?q=Aut+et+assumenda+esse+necessitatibus+et+soluta+quia+temporibus.&from=zh&to=en&appid=20220104001046264&salt=1641546261&sign=6bf4c1c8f9779e1124e4e7b9a0dacd93` resulted in a `502 No data received from server or forwarder` response:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
  <title>502 - (truncated...)
 in /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create()
#1 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#2 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()
#3 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run()
#5 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#7 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/Client.php(187): GuzzleHttp\Promise\Promise->wait()
#10 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/ClientTrait.php(44): GuzzleHttp\Client->request()
#11 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/app/Handlers/SlugTranslateHandler.php(42): GuzzleHttp\Client->get()
#12 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/app/Jobs/TranslateSlug.php(29): App\Handlers\SlugTranslateHandler->translate()
#13 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\TranslateSlug->handle()
#14 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#15 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#16 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#17 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#18 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#19 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#20 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#21 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#22 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow()
#23 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#24 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#25 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()
#26 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#27 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#28 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
#29 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()
#30 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(329): Illuminate\Queue\Worker->runJob()
#31 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->runNextJob()
#32 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()
#33 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#34 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#35 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#36 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#37 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#38 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#39 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute()
#40 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#41 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Application.php(1005): Illuminate\Console\Command->run()
#42 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#43 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#44 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run()
#45 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#46 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#47 {main}

</pre>
27、在开发环境中,我们为了测试方便,直接在命令行里调用 artisan queue:listen 进行队列监控。然而在生产环境中,我们需要配置一个进程管理工具来监控 queue:work 进程的状态并在需要时进行重启。安装 Supervisor,Supervisor 是一个用于 Linux 操作系统的进程监视器。如果它失败了,它将自动重启 queue 进程。安装 Supervisor,你可以使用以下命令。报错:[Errno 14] HTTP Error 502 – Bad Gateway


[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# yum install supervisor
Loaded plugins: fastestmirror
Determining fastest mirrors
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/epel/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
Resolving Dependencies
--> Running transaction check
---> Package supervisor.noarch 0:3.4.0-1.el7 will be installed
--> Processing Dependency: python-meld3 >= 0.6.5 for package: supervisor-3.4.0-1.el7.noarch
--> Processing Dependency: python-setuptools for package: supervisor-3.4.0-1.el7.noarch
--> Running transaction check
---> Package python-meld3.x86_64 0:0.6.10-1.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                                           Arch                 Version                      Repository          Size
==============================================================================================================================
Installing:
 supervisor                                        noarch               3.4.0-1.el7                  epel               498 k
Installing for dependencies:
 python-backports                                  x86_64               1.0-8.el7                    base               5.8 k
 python-backports-ssl_match_hostname               noarch               3.5.0.1-1.el7                base                13 k
 python-ipaddress                                  noarch               1.0.16-2.el7                 base                34 k
 python-meld3                                      x86_64               0.6.10-1.el7                 epel                73 k
 python-setuptools                                 noarch               0.9.8-7.el7                  base               397 k

Transaction Summary
==============================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 1.0 M
Installed size: 5.1 M
Is this ok [y/d/N]: y
Downloading packages:
python-backports-1.0-8.el7.x86 FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-backports-ssl_match_hos FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-meld3-0.6.10-1.el7.x86_ FAILED                                          
http://mirrors.cloud.aliyuncs.com/epel/7/x86_64/Packages/p/python-meld3-0.6.10-1.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-ipaddress-1.0.16-2.el7. FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-setuptools-0.9.8-7.el7. FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
supervisor-3.4.0-1.el7.noarch. FAILED                                          
http://mirrors.cloud.aliyuncs.com/epel/7/x86_64/Packages/s/supervisor-3.4.0-1.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.


Error downloading packages:
  python-backports-1.0-8.el7.x86_64: [Errno 256] No more mirrors to try.
  python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch: [Errno 256] No more mirrors to try.
  python-setuptools-0.9.8-7.el7.noarch: [Errno 256] No more mirrors to try.
  supervisor-3.4.0-1.el7.noarch: [Errno 256] No more mirrors to try.
  python-ipaddress-1.0.16-2.el7.noarch: [Errno 256] No more mirrors to try.
  python-meld3-0.6.10-1.el7.x86_64: [Errno 256] No more mirrors to try.




28、缘由应该是 yum 源已经过期了,重新配置阿里云的 CentOS 7 yum 源,参考网址:https://oneinstack.com/faq/yum-apt/ 。如图23
缘由应该是 yum 源已经过期了,重新配置阿里云的 CentOS 7 yum 源,参考网址:https://oneinstack.com/faq/yum-apt/

图23



[root@iZ23wv7v5ggZ ~]# cd /etc/yum.repos.d
[root@iZ23wv7v5ggZ yum.repos.d]# ls
CentOS-Base.repo  epel.repo
[root@iZ23wv7v5ggZ yum.repos.d]# rm -rf /etc/yum.repos.d/*.repo
[root@iZ23wv7v5ggZ yum.repos.d]# ls
[root@iZ23wv7v5ggZ yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0   4059      0 --:--:-- --:--:-- --:--:--  4056
[root@iZ23wv7v5ggZ yum.repos.d]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   664  100   664    0     0    639      0  0:00:01  0:00:01 --:--:--   640
[root@iZ23wv7v5ggZ yum.repos.d]# ls
CentOS-Base.repo  epel.repo
[root@iZ23wv7v5ggZ yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.cloud.aliyuncs.com
 * extras: mirrors.cloud.aliyuncs.com
 * updates: mirrors.cloud.aliyuncs.com
base                                                            | 3.6 kB  00:00:00     
epel                                                            | 4.7 kB  00:00:00     
extras                                                          | 2.9 kB  00:00:00     
updates                                                         | 2.9 kB  00:00:00     
(1/13): epel/x86_64/updateinfo                                  | 1.0 MB  00:00:00     
(2/13): epel/x86_64/prestodelta                                 |  450 B  00:00:00     
(3/13): base/7/x86_64/filelists_db                              | 7.2 MB  00:00:01     
(4/13): epel/x86_64/filelists_db                                |  12 MB  00:00:01     
(5/13): epel/x86_64/primary_db                                  | 7.0 MB  00:00:00     
(6/13): extras/7/x86_64/primary_db                              | 243 kB  00:00:00     
(7/13): extras/7/x86_64/filelists_db                            | 259 kB  00:00:00     
(8/13): epel/x86_64/other_db                                    | 3.4 MB  00:00:00     
(9/13): extras/7/x86_64/other_db                                | 145 kB  00:00:00     
(10/13): updates/7/x86_64/filelists_db                          | 7.4 MB  00:00:01     
(11/13): updates/7/x86_64/other_db                              | 955 kB  00:00:00     
(12/13): updates/7/x86_64/primary_db                            |  13 MB  00:00:02     
base/7/x86_64/other_db         FAILED                                          
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/ecaab5cc3b9c10fefe6be2ecbf6f9fcb437231dac3e82cab8d9d2cf70e99644d-other.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/ecaab5cc3b9c10fefe6be2ecbf6f9fcb437231dac3e82cab8d9d2cf70e99644d-other.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(13/13): base/7/x86_64/other_db                                 | 2.6 MB  00:00:00     
Metadata Cache Created
[root@iZ23wv7v5ggZ yum.repos.d]# ^C
[root@iZ23wv7v5ggZ yum.repos.d]# 



29、参考 Supervisor 配置:https://learnku.com/docs/laravel/8.5/queues/10395#e45763 ,再次安装 Supervisor。安装成功。


[root@iZ23wv7v5ggZ yum.repos.d]# yum install supervisor
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cloud.aliyuncs.com
 * extras: mirrors.cloud.aliyuncs.com
 * updates: mirrors.cloud.aliyuncs.com
Resolving Dependencies
--> Running transaction check
---> Package supervisor.noarch 0:3.4.0-1.el7 will be installed
--> Processing Dependency: python-meld3 >= 0.6.5 for package: supervisor-3.4.0-1.el7.noarch
--> Processing Dependency: python-setuptools for package: supervisor-3.4.0-1.el7.noarch
--> Running transaction check
---> Package python-meld3.x86_64 0:0.6.10-1.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package                                 Arch       Version             Repository
                                                                                  Size
=======================================================================================
Installing:
 supervisor                              noarch     3.4.0-1.el7         epel     498 k
Installing for dependencies:
 python-backports                        x86_64     1.0-8.el7           base     5.8 k
 python-backports-ssl_match_hostname     noarch     3.5.0.1-1.el7       base      13 k
 python-ipaddress                        noarch     1.0.16-2.el7        base      34 k
 python-meld3                            x86_64     0.6.10-1.el7        epel      73 k
 python-setuptools                       noarch     0.9.8-7.el7         base     397 k

Transaction Summary
=======================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 1.0 M
Installed size: 5.1 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
(1/6): python-backports-1.0-8.el7.x86_64.rpm                    | 5.8 kB  00:00:00     
(2/6): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch |  13 kB  00:00:00     
(3/6): python-ipaddress-1.0.16-2.el7.noarch.rpm                 |  34 kB  00:00:00     
(4/6): python-meld3-0.6.10-1.el7.x86_64.rpm                     |  73 kB  00:00:00     
(5/6): python-setuptools-0.9.8-7.el7.noarch.rpm                 | 397 kB  00:00:00     
(6/6): supervisor-3.4.0-1.el7.noarch.rpm                        | 498 kB  00:00:00     
---------------------------------------------------------------------------------------
Total                                                     726 kB/s | 1.0 MB  00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-meld3-0.6.10-1.el7.x86_64                                    1/6 
  Installing : python-ipaddress-1.0.16-2.el7.noarch                                2/6 
  Installing : python-backports-1.0-8.el7.x86_64                                   3/6 
  Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch            4/6 
  Installing : python-setuptools-0.9.8-7.el7.noarch                                5/6 
  Installing : supervisor-3.4.0-1.el7.noarch                                       6/6 
  Verifying  : supervisor-3.4.0-1.el7.noarch                                       1/6 
  Verifying  : python-backports-1.0-8.el7.x86_64                                   2/6 
  Verifying  : python-ipaddress-1.0.16-2.el7.noarch                                3/6 
  Verifying  : python-meld3-0.6.10-1.el7.x86_64                                    4/6 
  Verifying  : python-setuptools-0.9.8-7.el7.noarch                                5/6 
  Verifying  : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch            6/6 

Installed:
  supervisor.noarch 0:3.4.0-1.el7                                                      

Dependency Installed:
  python-backports.x86_64 0:1.0-8.el7                                                  
  python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7                           
  python-ipaddress.noarch 0:1.0.16-2.el7                                               
  python-meld3.x86_64 0:0.6.10-1.el7                                                   
  python-setuptools.noarch 0:0.9.8-7.el7                                               

Complete!
[root@iZ23wv7v5ggZ yum.repos.d]# 



30、创建一个 /etc/supervisord.d/app-wangqiang-larabbs-worker.ini 文件,启动并监视 queue:work 进程。指示 Supervisor 运行 2 个 queue:work 进程并监视所有进程。如图24
创建一个 /etc/supervisord.d/app-wangqiang-larabbs-worker.ini 文件,启动并监视 queue:work 进程。指示 Supervisor 运行 2 个 queue:work 进程并监视所有进程

图24



[root@iZ23wv7v5ggZ supervisord.d]# cat app-wangqiang-larabbs-worker.ini 
[program:app-wangqiang-larabbs-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan queue:work sqs --sleep=3 --tries=3 --max-time=600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log
stopwaitsecs=600
[root@iZ23wv7v5ggZ supervisord.d]# 



31、创建配置文件后,你可以更新 Supervisor 配置并使用以下命令启动进程。报错:unix:///var/run/supervisor/supervisor.sock no such file
<pre class="wp-block-syntaxhighlighter-code">

[root@iZ23wv7v5ggZ supervisord.d]# cd ~
[root@iZ23wv7v5ggZ ~]# supervisorctl reread
error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib64/python2.7/socket.py line: 224
[root@iZ23wv7v5ggZ ~]# supervisorctl status
unix:///var/run/supervisor/supervisor.sock no such file


</pre>
32、重启 ECS 实例后,执行命令:easy_install supervisor。查看 supervisord 运行状态:supervisorctl status,报错:can’t find command ‘php’。如图25
重启 ECS 实例后,执行命令:easy_install supervisor。查看 supervisord 运行状态:supervisorctl status,报错:can't find command 'php'

图25



[root@iZ23wv7v5ggZ ~]# easy_install supervisor
Searching for supervisor
Best match: supervisor 3.4.0
Adding supervisor 3.4.0 to easy-install.pth file
Installing echo_supervisord_conf script to /usr/bin
Installing pidproxy script to /usr/bin
Installing supervisorctl script to /usr/bin
Installing supervisord script to /usr/bin

Using /usr/lib/python2.7/site-packages
Processing dependencies for supervisor
Finished processing dependencies for supervisor
[root@iZ23wv7v5ggZ ~]# systemctl enable supervisord
Created symlink from /etc/systemd/system/multi-user.target.wants/supervisord.service to /usr/lib/systemd/system/supervisord.service.
[root@iZ23wv7v5ggZ ~]# systemctl restart supervisord
[root@iZ23wv7v5ggZ ~]# supervisorctl status
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_00   FATAL     can't find command 'php'
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_01   FATAL     can't find command 'php'
[root@iZ23wv7v5ggZ ~]# 


33、查看 php 的运行目录 which php,ini 配置文件的 command 的 php 加上绝对路径。如图26
查看 php 的运行目录 which php,ini 配置文件的 command 的 php 加上绝对路径

图26



[root@iZ23wv7v5ggZ ~]# which php
/usr/local/php/bin/php
[root@iZ23wv7v5ggZ ~]# vim /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[root@iZ23wv7v5ggZ ~]# cat /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[program:app-wangqiang-larabbs-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan queue:work sqs --sleep=3 --tries=3 --max-time=600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log
stopwaitsecs=600
[root@iZ23wv7v5ggZ ~]# 



34、重启 supervisord 后,查看状态,运行成功,但是提示:退出太快(进程日志可能有详细信息)。如图27
重启 supervisord 后,查看状态,运行成功,但是提示:退出太快(进程日志可能有详细信息)

图27



[root@iZ23wv7v5ggZ ~]# service supervisord restart
Redirecting to /bin/systemctl restart supervisord.service
[root@iZ23wv7v5ggZ ~]# supervisorctl status
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_00   BACKOFF   Exited too quickly (process log may have details)
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_01   STARTING  
[root@iZ23wv7v5ggZ ~]# 


35、查看 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log,提示:Class ‘Aws\Sqs\SqsClient’ not found。如图29
查看 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log,提示:Class 'Aws\Sqs\SqsClient' not found

图29



[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# cat worker.log 

   Error 

  Class 'Aws\Sqs\SqsClient' not found

  at /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php:26
     22▕             $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
     23▕         }
     24▕ 
     25▕         return new SqsQueue(
  ➜  26▕             new SqsClient($config),
     27▕             $config['queue'],
     28▕             $config['prefix'] ?? '',
     29▕             $config['suffix'] ?? '',
     30▕             $config['after_commit'] ?? null

      +18 vendor frames 
  19  /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

      +18 vendor frames 
  19  /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan:37
      Illuminate\Foundation\Console\Kernel::handle()



36、ini 配置文件的 command 的 php ,删除掉 sqs,然后重启后,查看状态,一直处于运行中。如图30
ini 配置文件的 command 的 php ,删除掉 sqs,然后重启后,查看状态,一直处于运行中

图30



[root@iZ23wv7v5ggZ ~]# vim /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[root@iZ23wv7v5ggZ ~]# cat /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[program:app-wangqiang-larabbs-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan queue:work --sleep=3 --tries=3 --max-time=600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log
stopwaitsecs=600
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# service supervisord restart
Redirecting to /bin/systemctl restart supervisord.service
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# supervisorctl status
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_00   RUNNING   pid 2277, uptime 0:00:07
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_01   RUNNING   pid 2276, uptime 0:00:07




37、测试队列是否生效,重启 ECS 后,新建一个话题,其详情页面的网址为:https://app-wangqiang-larabbs.shuijingwanwq.com/topics/105 。刷新一下,其会 301 跳转至:https://app-wangqiang-larabbs.shuijingwanwq.com/topics/105/a-german 。表明队列生效中。如图31
测试队列是否生效,重启 ECS 后,新建一个话题,其详情页面的网址为:https://app-wangqiang-larabbs.shuijingwanwq.com/topics/105 。刷新一下,其会 301 跳转至:https://app-wangqiang-larabbs.shuijingwanwq.com/topics/105/a-german 。表明队列生效中

图31

38、计划任务的实现,使用调度器时,我们需要修改系统的 Cron 计划任务配置信息,运行以下命令,添加新的调度任务。部署完毕。如图32
计划任务的实现,使用调度器时,我们需要修改系统的 Cron 计划任务配置信息,运行以下命令,添加新的调度任务。部署完毕

图32



[root@iZ23wv7v5ggZ ~]# export EDITOR=vi && crontab -e
crontab: installing new crontab

* * * * * /usr/local/php/bin/php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan schedule:run >> /dev/null 2>&1


]]>
https://www.shuijingwanwq.com/2022/01/28/5867/feed/ 0
在阿里云大陆 ECS 的 CentOS 7.x 中安装 V2Ray 后 HTTP 请求 Google、YouTube 的实现 https://www.shuijingwanwq.com/2021/06/30/4991/ https://www.shuijingwanwq.com/2021/06/30/4991/#respond Wed, 30 Jun 2021 03:00:33 +0000 https://www.shuijingwanwq.com/?p=4991 Post Views: 478

1、列出所有版本信息,执行命令:lsb_release -a。版本:CentOS 7.7。如图1

列出所有版本信息,执行命令:lsb_release -a。版本:CentOS 7.7。

图1


[root@iZ23wv7v5ggZ ~]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.7.1908 (Core)
Release:        7.7.1908
Codename:       Core
[root@iZ23wv7v5ggZ ~]#



2、查看 bash 版本:4.2.46。如图2

查看 bash 版本:4.2.46

图2


[root@iZ23wv7v5ggZ bin]# bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@iZ23wv7v5ggZ bin]# ^C
[root@iZ23wv7v5ggZ bin]#



3、安装和更新 V2Ray,参考网址:https://github.com/v2fly/fhs-install-v2ray/blob/master/README.zh-Hans-CN.md 。如图3

安装和更新 V2Ray,参考网址:https://github.com/v2fly/fhs-install-v2ray/blob/master/README.zh-Hans-CN.md

图3


[root@iZ23wv7v5ggZ ~]# bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21613  100 21613    0     0  21964      0 --:--:-- --:--:-- --:--:-- 21964
info: Installing V2Ray v4.40.1 for x86_64
Downloading V2Ray archive: https://github.com/v2fly/v2ray-core/releases/download/v4.40.1/v2ray-linux-64.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   626  100   626    0     0    734      0 --:--:-- --:--:-- --:--:--   733
100 12.3M  100 12.3M    0     0  2996k      0  0:00:04  0:00:04 --:--:-- 4167k
Downloading verification file for V2Ray archive: https://github.com/v2fly/v2ray-core/releases/download/v4.40.1/v2ray-linux-64.zip.dgst
info: Extract the V2Ray package to /tmp/tmp.Kbb2Sg6CcW and prepare it for installation.
rm: cannot remove ‘/etc/systemd/system/v2ray.service.d/10-donot_touch_multi_conf.conf’: No such file or directory
rm: cannot remove ‘/etc/systemd/system/v2ray@.service.d/10-donot_touch_multi_conf.conf’: No such file or directory
info: Systemd service files have been installed successfully!
warning: The following are the actual parameters for the v2ray service startup.
warning: Please make sure the configuration file path is correctly set.
~~~~~~~~~~~~~~~~
[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target

[Service]
User=nobody
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target
# In case you have a good reason to do so, duplicate this file in the same directory and make your customizes there.
# Or all changes you made will be lost!  # Refer: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Service]
ExecStart=
ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json
~~~~~~~~~~~~~~~~
warning: The systemd version on the current operating system is too low.
warning: Please consider to upgrade the systemd or the operating system.

installed: /usr/local/bin/v2ray
installed: /usr/local/bin/v2ctl
installed: /usr/local/share/v2ray/geoip.dat
installed: /usr/local/share/v2ray/geosite.dat
installed: /usr/local/etc/v2ray/config.json
installed: /var/log/v2ray/
installed: /var/log/v2ray/access.log
installed: /var/log/v2ray/error.log
installed: /etc/systemd/system/v2ray.service
installed: /etc/systemd/system/v2ray@.service
removed: /tmp/tmp.Kbb2Sg6CcW
info: V2Ray v4.40.1 is installed.
You may need to execute a command to remove dependent software: yum remove curl unzip
Please execute the command: systemctl enable v2ray; systemctl start v2ray
[root@iZ23wv7v5ggZ ~]# systemctl enable v2ray
Created symlink from /etc/systemd/system/multi-user.target.wants/v2ray.service to /etc/systemd/system/v2ray.service.
[root@iZ23wv7v5ggZ ~]# systemctl start v2ray
[root@iZ23wv7v5ggZ ~]#




4、我购买了一个商业版本的 V2RAY 服务端 GetSS,选择香港的 Azure 服务器,复制 URL。其值已不可用,我做了修改。如图4

我购买了一个商业版本的 V2RAY 服务端 GetSS,选择香港的 Azure 服务器,复制 URL

图4


vmess://eyJhZGQiOiJoazAxLmdldHNzLnRvcCIsImhvc3QiOiIiLCJpZCI6IjRBNjMzOEU0LTI3RDItQkQ5My01MUI1LUIzQjIxRUEwM0JFMiIsIm5ldCI6InRjcCIsInBhdGgiOiIiLCJwb3J0IjoiMjM0NTYiLCJ5wcyI6IkhLLUhLVC14MCIsInRscy66I6IiIsInYiOjIsImFpZCI6MCwidHlwZSI6Im5vbmUifQ==


5、将 vmess:// 后面的值 base64 解码后。json 格式化,其值如下。后续用于配置阿里云服务器上的 V2RAY 客户端。其值已不可用,我做了修改。如图5

将 vmess:// 后面的值 base64 解码后。json 格式化,其值如下。后续用于配置阿里云服务器上的 V2RAY 客户端

图5


{
  "add": "hk01.getss.top",
  "host": "",
  "id": "4A6338E4-27D2-BD93-515B5-B3B21EA6603BE2",
  "net": "tcp",
  "path": "",
  "port": "23456",
  "ps": "HK-HKT-x0",
  "tls": "",
  "v": 2,
  "aid": 0,
  "type": "none"
}


6、查看文件 /usr/local/etc/v2ray/config.json,其值为空对象



[root@iZ23wv7v5ggZ ~]# cat /usr/local/etc/v2ray/config.json
{}
[root@iZ23wv7v5ggZ ~]#



7、V2Ray 没有使用常规代理软件的 C/S(即客户端/服务器)结构,它既可以当做服务器也可以作为客户端。配置客户端,参考文件:C:\Users\Administrator\AppData\Roaming\GetSS\config.json。GetSS 为 Windows 客户端。编辑 /usr/local/etc/v2ray/config.json。如图6

V2Ray 没有使用常规代理软件的 C/S(即客户端/服务器)结构,它既可以当做服务器也可以作为客户端。配置客户端,参考文件:C:\Users\Administrator\AppData\Roaming\GetSS\config.json。GetSS 为 Windows 客户端。编辑 /usr/local/etc/v2ray/config.json

图6


{
    "policy": {
        "levels": {
            "0": {
                "uplinkOnly": 0
            }
        }
    },
    "inbound": {
        "listen": "127.0.0.1",
        "port": 1081,
        "protocol": "socks",
        "settings": {
            "auth": "noauth",
            "udp": false,
            "ip": "127.0.0.1"
        }
    },
    "inboundDetour": [
        {
            "listen": "127.0.0.1",
            "allocate": {
                "strategy": "always",
                "refresh": 5,
                "concurrency": 3
            },
            "port": 8001,
            "protocol": "http",
            "tag": "httpDetour",
            "domainOverride": [
                "http",
                "tls"
            ],
            "streamSettings": {},
            "settings": {
                "timeout": 0
            }
        }
    ],
    "log": {
        "loglevel": "warning"
    },
    "dns": {
        "servers": [
            "223.5.5.5"
        ]
    },
    "outboundDetour": [
        {
            "protocol": "freedom",
            "tag": "direct",
            "settings": {}
        }
    ],
    "outbound": {
        "sendThrough": "0.0.0.0",
        "mux": {
            "enabled": false,
            "concurrency": 8
        },
        "protocol": "vmess",
        "settings": {
            "vnext": [
                {
                    "address": "hk01.getss.top",
                    "port": 23456,
                    "users": [
                        {
                            "id": "4A6338E4-27D2-BD5593-51B5-B3B21EA03BE2",
                            "alterId": 0,
                            "security": "auto",
                            "level": 0
                        }
                    ],
                    "remark": "HK-HKT-x0"
                }
            ]
        },
        "streamSettings": {
            "wsSettings": {
                "path": "",
                "headers": {
                    "Host": ""
                }
            },
            "tcpSettings": {
                "header": {
                    "type": "none"
                }
            },
            "security": "",
            "tlsSettings": {
                "serverName": "",
                "allowInsecure": false
            },
            "httpSettings": {
                "path": "",
                "host": [
                    ""
                ]
            },
            "kcpSettings": {
                "header": {
                    "type": "none"
                },
                "mtu": 1350,
                "congestion": false,
                "tti": 20,
                "uplinkCapacity": 5,
                "writeBufferSize": 1,
                "readBufferSize": 1,
                "downlinkCapacity": 20
            },
            "network": "tcp"
        }
    }
}


8、使用 V2Ray 提供的配置检查功能(test 选项),因为可以检查 JSON 语法错误外的问题,比如说突然间手抖把 vmess 写成了 vmss,一下子就检查出来了。如果是配置文件没问题,则是这样的。


[root@iZ23wv7v5ggZ ~]# /usr/local/bin/v2ray -test -config /usr/local/etc/v2ray/config.json
V2Ray 4.40.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.16.5 linux/amd64)
A unified platform for anti-censorship.
Configuration OK.
[root@iZ23wv7v5ggZ ~]# 


9、VMess 协议的认证基于时间,一定要保证服务器和客户端的系统时间相差要在90秒以内。查看阿里云服务器的系统时间。


[root@iZ23wv7v5ggZ ~]# date
Thu Jun 24 16:50:13 CST 2021
[root@iZ23wv7v5ggZ ~]# 


10、实际上数据包的流向:{浏览器} <–(socks)–> {V2Ray 客户端 inbound <-> V2Ray 客户端 outbound} <–(VMess)–> {V2Ray 服务器 inbound <-> V2Ray 服务器 outbound} <–(Freedom)–> {目标网站}。

11、查看与代理端口 1081 相链接的端口。显示所有连线中的 Socket。


[root@iZ23wv7v5ggZ ~]# netstat -nat | grep 1081 -a
tcp6       0      0 :::1080                 :::*                    LISTEN     
[root@iZ23wv7v5ggZ ~]# 


12、测试阿里云服务器基于 socks 请求 http://httpbin.org/ip、https://www.google.com、https://www.youtube.com。连接成功。如图7

测试阿里云服务器基于 socks 请求 http://httpbin.org/ip、https://www.google.com、https://www.youtube.com。连接成功

图7


[root@iZ23wv7v5ggZ v2ray]# curl --socks5 127.0.0.1:1081 http://httpbin.org/ip
{
  "origin": "14.192.49.13"
}
[root@iZ23wv7v5ggZ v2ray]# curl --socks5 127.0.0.1:1081 http://www.google.com
curl: (52) Empty reply from server
[root@iZ23wv7v5ggZ v2ray]# curl --socks5 127.0.0.1:1081 https://www.google.com
curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.
[root@iZ23wv7v5ggZ v2ray]# curl -v --socks5 127.0.0.1:1081 https://sitekit.withgoogle.com
* About to connect() to proxy 127.0.0.1 port 1081 (#0)
*   Trying 127.0.0.1...
* 216
* 58
* 200
* 49
* Connected to 127.0.0.1 (127.0.0.1) port 1081 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=*.appspot.com,O=Google LLC,L=Mountain View,ST=California,C=US
*       start date: May 31 01:07:40 2021 GMT
*       expire date: Aug 23 01:07:39 2021 GMT
*       common name: *.appspot.com
*       issuer: CN=GTS CA 1O1,O=Google Trust Services,C=US
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: sitekit.withgoogle.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< Vary: Accept-Encoding
< X-Cloud-Trace-Context: f0ad2afe1e1be1a7fd9d592b1b2e4c62
< Date: Fri, 25 Jun 2021 09:35:19 GMT
< Server: Google Frontend
< Content-Length: 89089
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
< 

[root@iZ23wv7v5ggZ ~]# curl -v --socks5 127.0.0.1:1081 https://www.youtube.com
* About to connect() to proxy 127.0.0.1 port 1081 (#0)
*   Trying 127.0.0.1...
* 172
* 217
* 160
* 110
* Connected to 127.0.0.1 (127.0.0.1) port 1081 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=*.google.com,O=Google LLC,L=Mountain View,ST=California,C=US
*       start date: May 31 01:35:44 2021 GMT
*       expire date: Aug 23 01:35:43 2021 GMT
*       common name: *.google.com
*       issuer: CN=GTS CA 1O1,O=Google Trust Services,C=US
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.youtube.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< X-Content-Type-Options: nosniff
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: Mon, 01 Jan 1990 00:00:00 GMT
< Date: Mon, 28 Jun 2021 11:09:13 GMT
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=31536000
< permissions-policy: ch-ua-full-version=*, ch-ua-platform=*, ch-ua-platform-version=*, ch-ua-arch=*, ch-ua-model=*
< P3P: CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info."
< Server: ESF
< X-XSS-Protection: 0
< Set-Cookie: GPS=1; Domain=.youtube.com; Expires=Mon, 28-Jun-2021 11:39:13 GMT; Path=/; Secure; HttpOnly
< Set-Cookie: YSC=Mpx-P60pfFM; Domain=.youtube.com; Path=/; Secure; HttpOnly; SameSite=none
< Set-Cookie: VISITOR_INFO1_LIVE=I25nZHCzTQA; Domain=.youtube.com; Expires=Sat, 25-Dec-2021 11:09:13 GMT; Path=/; Secure; HttpOnly; SameSite=none
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
< Accept-Ranges: none
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< 
var ytcfg={d:function(){return window.yt&&yt.config_||ytcfg.data_||(ytcfg.data_={})},get:function(k,o){return k in ytcfg.d()?ytcfg.d()[k]:o},set:function(){var a=arguments;if(a.length>1)ytcfg.d()[a[0]]=a[1];else for(var k in a[0])ytcfg.d()[k]=a[0][k]}}; 

</pre>

13、阿里云服务器开放的端口 1081、8118 需要 运行命令开放。打开防火墙 iptables。如图8

阿里云服务器开放的端口 1081、8118 需要 运行命令开放。打开防火墙 iptables

图8


[root@iZ23wv7v5ggZ ~]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.21 on Mon Jun 28 19:53:18 2021
*filter
:INPUT DROP [2:80]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [247:63813]
:syn-flood - [0:0]
-A INPUT -p tcp -m tcp --dport 8118 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1081 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1080 -m state --state NEW -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
COMMIT
# Completed on Mon Jun 28 19:53:18 2021
[root@iZ23wv7v5ggZ v2ray]# iptables -I INPUT -p tcp --dport 1081 -m state --state NEW -j ACCEPT
[root@iZ23wv7v5ggZ v2ray]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@iZ23wv7v5ggZ v2ray]# cat /etc/sysconfig/iptables
# Generated by iptables-save v1.4.21 on Fri Jun 25 17:19:08 2021
*filter
:INPUT DROP [2:80]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [580:261280]
:syn-flood - [0:0]
-A INPUT -p tcp -m tcp --dport 1081 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1080 -m state --state NEW -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
COMMIT
# Completed on Fri Jun 25 17:19:08 2021
[root@iZ23wv7v5ggZ v2ray]# 


14、安装配置 Privoxy,修改配置文件 /etc/privoxy/config。如图9

安装配置 Privoxy,修改配置文件 /etc/privoxy/config

图9


/usr/local/bin/v2ray -test -config /usr/local/etc/v2ray/config.json
[root@iZ23wv7v5ggZ ~]# yum -y install privoxy
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                     | 3.6 kB     00:00
epel                                                     | 4.7 kB     00:00
extras                                                   | 2.9 kB     00:00
updates                                                  | 2.9 kB     00:00
(1/7): base/7/x86_64/group_gz                              | 153 kB   00:00
(2/7): epel/x86_64/group_gz                                |  96 kB   00:00
(3/7): epel/x86_64/updateinfo                              | 1.0 MB   00:00
(4/7): extras/7/x86_64/primary_db                          | 242 kB   00:00
(5/7): base/7/x86_64/primary_db                            | 6.1 MB   00:00
(6/7): epel/x86_64/primary_db                              | 6.9 MB   00:00
(7/7): updates/7/x86_64/primary_db                         | 8.8 MB   00:00
Resolving Dependencies
--> Running transaction check
---> Package privoxy.x86_64 0:3.0.32-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch             Version                Repository      Size
================================================================================
Installing:
 privoxy           x86_64           3.0.32-1.el7           epel           998 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 998 k
Installed size: 3.1 M
Downloading packages:
privoxy-3.0.32-1.el7.x86_64.rpm                            | 998 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : privoxy-3.0.32-1.el7.x86_64                                  1/1
  Verifying  : privoxy-3.0.32-1.el7.x86_64                                  1/1

Installed:
  privoxy.x86_64 0:3.0.32-1.el7

Complete!

[root@iZ23wv7v5ggZ ~]# systemctl enable privoxy
Created symlink from /etc/systemd/system/multi-user.target.wants/privoxy.service to /usr/lib/systemd/system/privoxy.service.
[root@iZ23wv7v5ggZ ~]# systemctl start privoxy
[root@iZ23wv7v5ggZ ~]# systemctl status privoxy
● privoxy.service - Privoxy Web Proxy With Advanced Filtering Capabilities
   Loaded: loaded (/usr/lib/systemd/system/privoxy.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-06-24 11:08:07 CST; 5s ago
  Process: 6845 ExecStart=/usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy /etc/privoxy/config (code=exited, status=0/SUCCESS)
 Main PID: 6846 (privoxy)
   CGroup: /system.slice/privoxy.service
           └─6846 /usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy...

Jun 24 11:08:06 iZ23wv7v5ggZ systemd[1]: Starting Privoxy Web Proxy With Adv....
Jun 24 11:08:07 iZ23wv7v5ggZ systemd[1]: Started Privoxy Web Proxy With Adva....
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZ23wv7v5ggZ ~]# yum install w3m -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package w3m.x86_64 0:0.5.3-50.git20210102.el7 will be installed
--> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: w3m-0.5.3-50.git20210102.el7.x86_64
--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: w3m-0.5.3-50.git20210102.el7.x86_64
--> Processing Dependency: perl(NKF) for package: w3m-0.5.3-50.git20210102.el7.x86_64
--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: w3m-0.5.3-50.git20210102.el7.x86_64
--> Processing Dependency: libgc.so.1()(64bit) for package: w3m-0.5.3-50.git20210102.el7.x86_64
--> Processing Dependency: libssl.so.1.1()(64bit) for package: w3m-0.5.3-50.git20210102.el7.x86_64
--> Running transaction check
---> Package gc.x86_64 0:7.2d-7.el7 will be installed
---> Package openssl11-libs.x86_64 1:1.1.1g-3.el7 will be installed
---> Package perl-NKF.x86_64 1:2.1.3-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch        Version                        Repository
                                                                           Size
================================================================================
Installing:
 w3m                 x86_64      0.5.3-50.git20210102.el7       epel      980 k
Installing for dependencies:
 gc                  x86_64      7.2d-7.el7                     base      158 k
 openssl11-libs      x86_64      1:1.1.1g-3.el7                 epel      1.5 M
 perl-NKF            x86_64      1:2.1.3-5.el7                  epel      131 k

Transaction Summary
================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 2.7 M
Installed size: 6.5 M
Downloading packages:
(1/4): gc-7.2d-7.el7.x86_64.rpm                            | 158 kB   00:00
(2/4): perl-NKF-2.1.3-5.el7.x86_64.rpm                     | 131 kB   00:00
(3/4): openssl11-libs-1.1.1g-3.el7.x86_64.rpm              | 1.5 MB   00:00
(4/4): w3m-0.5.3-50.git20210102.el7.x86_64.rpm             | 980 kB   00:00
--------------------------------------------------------------------------------
Total                                              5.0 MB/s | 2.7 MB  00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:openssl11-libs-1.1.1g-3.el7.x86_64                         1/4
  Installing : gc-7.2d-7.el7.x86_64                                         2/4
  Installing : 1:perl-NKF-2.1.3-5.el7.x86_64                                3/4
  Installing : w3m-0.5.3-50.git20210102.el7.x86_64                          4/4
  Verifying  : 1:perl-NKF-2.1.3-5.el7.x86_64                                1/4
  Verifying  : gc-7.2d-7.el7.x86_64                                         2/4
  Verifying  : w3m-0.5.3-50.git20210102.el7.x86_64                          3/4
  Verifying  : 1:openssl11-libs-1.1.1g-3.el7.x86_64                         4/4

Installed:
  w3m.x86_64 0:0.5.3-50.git20210102.el7

Dependency Installed:
  gc.x86_64 0:7.2d-7.el7              openssl11-libs.x86_64 1:1.1.1g-3.el7
  perl-NKF.x86_64 1:2.1.3-5.el7

Complete!
[root@iZ23wv7v5ggZ ~]# vi /etc/privoxy/config
[root@iZ23wv7v5ggZ ~]#




listen-address 127.0.0.1:8118
forward-socks5t / 127.0.0.1:1081 .


15、设置 http/https 代理,修改配置文件 /etc/profile。172.16.6.176 为服务器内网IP,表示不用代理。如图10

设置 http/https 代理,修改配置文件 /etc/profile。172.16.6.176 为服务器内网IP,表示不用代理

图10


[root@iZ23wv7v5ggZ ~]# vi /etc/profile
[root@iZ23wv7v5ggZ ~]# systemctl stop privoxy
[root@iZ23wv7v5ggZ ~]# systemctl start privoxy
[root@iZ23wv7v5ggZ ~]# systemctl status privoxy
● privoxy.service - Privoxy Web Proxy With Advanced Filtering Capabilities
   Loaded: loaded (/usr/lib/systemd/system/privoxy.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-06-25 19:17:34 CST; 10s ago
  Process: 10823 ExecStart=/usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy /etc/privoxy/config (code=exited, status=0/SUCCESS)
 Main PID: 10824 (privoxy)
   CGroup: /system.slice/privoxy.service
           └─10824 /usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy /etc/privoxy/config

Jun 25 19:17:33 iZ23wv7v5ggZ systemd[1]: Starting Privoxy Web Proxy With Advanced Filtering Capabilities...
Jun 25 19:17:34 iZ23wv7v5ggZ systemd[1]: Started Privoxy Web Proxy With Advanced Filtering Capabilities.
[root@iZ23wv7v5ggZ ~]# 



export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118
export no_proxy="172.16.6.176"


16、测试阿里云服务器基于 curl http 请求 http://httpbin.org/ip、https://www.google.com、https://www.youtube.com。连接成功。如图11

测试阿里云服务器基于 curl http 请求 http://httpbin.org/ip、https://www.google.com、https://www.youtube.com。连接成功

图11


[root@iZ23wv7v5ggZ ~]# curl -v http://httpbin.org/ip
* About to connect() to proxy 127.0.0.1 port 8118 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8118 (#0)
> GET http://httpbin.org/ip HTTP/1.1
> User-Agent: curl/7.29.0
> Host: httpbin.org
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 OK
< Date: Tue, 29 Jun 2021 11:28:55 GMT
< Content-Type: application/json
< Content-Length: 31
< Connection: keep-alive
< Server: gunicorn/19.9.0
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Proxy-Connection: keep-alive
< 
{
  "origin": "14.192.49.13"
}
* Connection #0 to host 127.0.0.1 left intact
[root@iZ23wv7v5ggZ ~]# curl -v http://www.google.com
* About to connect() to proxy 127.0.0.1 port 8118 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8118 (#0)
> GET http://www.google.com/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.google.com
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 302 Found
< Location: http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1624966178742441&usg=AOvVaw2QC6Lusz__XY4CV4128vDo
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< Date: Tue, 29 Jun 2021 11:29:08 GMT
< Server: gws
< Content-Length: 370
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< Set-Cookie: 1P_JAR=2021-06-29-11; expires=Thu, 29-Jul-2021 11:29:08 GMT; path=/; domain=.google.com; Secure
< Set-Cookie: NID=218=mAQ-WwaoohthEWglgFX6uc1oS1THml90khjAACvGj_9OGJ73I3SvN6kwGB4ahRX3uZh5Sw0__Q-y5ahjTAvJtItGntahKmj_d4ESUipCEyIjCRsskk88MU_sF6xOPwhvpqQdY3Zs5ZdscNbvbvB5Z0n0iVnRtGayv2Is44Z8phc; expires=Wed, 29-Dec-2021 11:29:08 GMT; path=/; domain=.google.com; HttpOnly
< Proxy-Connection: keep-alive
< 

302 Moved
302 Moved
The document has moved
here.

* Connection #0 to host 127.0.0.1 left intact
[root@iZ23wv7v5ggZ ~]# curl -v https://www.google.com
* About to connect() to proxy 127.0.0.1 port 8118 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8118 (#0)
* Establish HTTP proxy tunnel to www.google.com:443
> CONNECT www.google.com:443 HTTP/1.1
> Host: www.google.com:443
> User-Agent: curl/7.29.0
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=www.google.com,O=Google LLC,L=Mountain View,ST=California,C=US
*       start date: May 31 03:52:12 2021 GMT
*       expire date: Aug 23 03:52:11 2021 GMT
*       common name: www.google.com
*       issuer: CN=GTS CA 1O1,O=Google Trust Services,C=US
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.google.com
> Accept: */*
> 
< HTTP/1.1 302 Found
< Location: https://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=https://www.google.com.hk/&ust=1624966197905473&usg=AOvVaw3rpxJ3M42WvO-874oCUUAA
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< Date: Tue, 29 Jun 2021 11:29:27 GMT
< Server: gws
< Content-Length: 372
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< Set-Cookie: 1P_JAR=2021-06-29-11; expires=Thu, 29-Jul-2021 11:29:27 GMT; path=/; domain=.google.com; Secure
< Set-Cookie: NID=218=Oer550Xi5XY2PWWVqYODOuO0eo3bDFJv7wRpooU1FMnNvfWZSI9azb4-oPY_CIbBjn1Wyt4ycJYne9IHTdySDugiDbXhZeEnWSt66bpphBWLPcNyQyEqIS1ltdCHGJw_C8XV3LSlF2NSUbtI825BQGha3baM6qJVvQI2x2Pj-XU; expires=Wed, 29-Dec-2021 11:29:27 GMT; path=/; domain=.google.com; HttpOnly
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
< 

302 Moved
302 Moved
The document has moved
here.

* Connection #0 to host 127.0.0.1 left intact
[root@iZ23wv7v5ggZ ~]# curl -v https://sitekit.withgoogle.com
* About to connect() to proxy 127.0.0.1 port 8118 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8118 (#0)
* Establish HTTP proxy tunnel to sitekit.withgoogle.com:443
> CONNECT sitekit.withgoogle.com:443 HTTP/1.1
> Host: sitekit.withgoogle.com:443
> User-Agent: curl/7.29.0
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=*.appspot.com,O=Google LLC,L=Mountain View,ST=California,C=US
*       start date: Jun 07 01:07:29 2021 GMT
*       expire date: Aug 30 01:07:28 2021 GMT
*       common name: *.appspot.com
*       issuer: CN=GTS CA 1O1,O=Google Trust Services,C=US
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: sitekit.withgoogle.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< Vary: Accept-Encoding
< X-Cloud-Trace-Context: 803be8061a081faa119115967f932ca2
< Date: Tue, 29 Jun 2021 11:29:47 GMT
< Server: Google Frontend
< Content-Length: 89089
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
< 

^C
[root@iZ23wv7v5ggZ ~]# curl -v https://www.youtube.com
* About to connect() to proxy 127.0.0.1 port 8118 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8118 (#0)
* Establish HTTP proxy tunnel to www.youtube.com:443
> CONNECT www.youtube.com:443 HTTP/1.1
> Host: www.youtube.com:443
> User-Agent: curl/7.29.0
> Proxy-Connection: Keep-Alive
> 
< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=*.google.com,O=Google LLC,L=Mountain View,ST=California,C=US
*       start date: May 31 01:35:44 2021 GMT
*       expire date: Aug 23 01:35:43 2021 GMT
*       common name: *.google.com
*       issuer: CN=GTS CA 1O1,O=Google Trust Services,C=US
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.youtube.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< X-Content-Type-Options: nosniff
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: Mon, 01 Jan 1990 00:00:00 GMT
< Date: Tue, 29 Jun 2021 11:30:03 GMT
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=31536000
< permissions-policy: ch-ua-full-version=*, ch-ua-platform=*, ch-ua-platform-version=*, ch-ua-arch=*, ch-ua-model=*
< P3P: CP="This is not a P3P policy! See http://support.google.com/accounts/answer/151657?hl=en for more info."
< Server: ESF
< X-XSS-Protection: 0
< Set-Cookie: GPS=1; Domain=.youtube.com; Expires=Tue, 29-Jun-2021 12:00:03 GMT; Path=/; Secure; HttpOnly
< Set-Cookie: YSC=qYlVjgY4Muk; Domain=.youtube.com; Path=/; Secure; HttpOnly; SameSite=none
< Set-Cookie: VISITOR_INFO1_LIVE=kVRgqbeY_lI; Domain=.youtube.com; Expires=Sun, 26-Dec-2021 11:30:03 GMT; Path=/; Secure; HttpOnly; SameSite=none
< Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
< Accept-Ranges: none
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< 
^C
[root@iZ23wv7v5ggZ ~]# 


 

]]>
https://www.shuijingwanwq.com/2021/06/30/4991/feed/ 0
基于阿里云的 ECS、RDS,将个人博客迁移升级至:Docker(基于预算考虑,最终未实现)、LNMP(CentOS 7.7、Nginx 1.16、MySQL 5.7、PHP 7.4)、HTTPS 的过程 https://www.shuijingwanwq.com/2019/12/06/3670/ https://www.shuijingwanwq.com/2019/12/06/3670/#comments Fri, 06 Dec 2019 03:09:07 +0000 http://www.shuijingwanwq.com/?p=3670 Post Views: 202 1、基于 Xshell 6 进入 CentOS 服务器中,将网站程序目录压缩打包,执行压缩命令,执行结果如图1
基于 Xshell 6 进入 CentOS 服务器中,将网站程序目录压缩打包,执行压缩命令

图1



cd /data/wwwroot/shuijingwanwq.com
zip -r shuijingwanwq.com-20191203.zip /data/wwwroot/shuijingwanwq.com


2、基于 FlashFXP 连接至 FTP 服务器中,将压缩包:shuijingwanwq.com-20191203.zip 下载至本地,如图2
基于 FlashFXP 连接至 FTP 服务器中,将压缩包:shuijingwanwq.com-20191203.zip 下载至本地

图2

3、基于 phpMyAdmin 连接至 MySQL 服务器,导出个人博客所使用的数据库:shuijingwanwq,文件名为:shuijingwanwq.sql,如图3
基于 phpMyAdmin 连接至 MySQL 服务器,导出个人博客所使用的数据库:shuijingwanwq,文件名为:shuijingwanwq.sql

图3

4、在阿里云容器服务中创建集群,如图4、图5、图6、图7
创建虚拟交换机

图4

 
Worker 实例,选择已有实例

图5

 
集群的其他配置

图6

 
创建集群,状态检测皆为通过

图7

5、发现费用严重超出预算(预算仅为4K),即使按照 Master 实例的最低配置,2核4G,一年下来,费用总计也是接近 5 位数了,最终决定继续沿用原生 CentOS,仅重新升级一下硬件配置与软件版本 6、硬件配置上,决定将数据盘扩容,从 10 GiB 扩容至 40 GiB,如图8
硬件配置上,决定将数据盘扩容,从 10 GiB 扩容至 40 GiB

图8

7、扩容后容量 40 GiB,如图9
扩容后容量 40 GiB

图9

8、停止 ECS 实例,如图10
停止 ECS 实例

图10

9、更换操作系统,如图11
更换操作系统

图11

10、更换操作系统,CentOS 7.7 64位,如图12
更换操作系统,CentOS 7.7 64位

图12

11、停止 ECS 实例后,实例磁盘列表中,系统盘更换操作系统后,系统磁盘已经自动初始化。因此,仅需要数据盘重新初始化,如图13
停止 ECS 实例后,实例磁盘列表中,系统盘更换操作系统后,系统磁盘已经自动初始化。因此,仅需要数据盘重新初始化

图13

12、云数据库RDS,数据库类型:MySQL 5.7,其可用区与 ECS 是一致的,如图14
云数据库RDS,数据库类型:MySQL 5.7,其可用区与 ECS 是一致的

图14

13、挂载数据盘,打开网址:https://oneinstack.com/question/how-to-mount-a-data-disc/ ,挂载成功,如图15
挂载数据盘,打开网址:https://oneinstack.com/question/how-to-mount-a-data-disc/ ,挂载成功

图15



[root@iZ23wv7v5ggZ ~]# wget http://mirrors.linuxeye.com/scripts/auto_fdisk.sh
--2019-12-05 11:29:45--  http://mirrors.linuxeye.com/scripts/auto_fdisk.sh
Resolving mirrors.linuxeye.com (mirrors.linuxeye.com)... 61.160.200.234
Connecting to mirrors.linuxeye.com (mirrors.linuxeye.com)|61.160.200.234|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5598 (5.5K) [text/x-json]
Saving to: ‘auto_fdisk.sh’

100%[=======================================================================================>] 5,598       --.-K/s   in 0.006s  

2019-12-05 11:29:45 (970 KB/s) - ‘auto_fdisk.sh’ saved [5598/5598]

[root@iZ23wv7v5ggZ ~]# chmod +x ./auto_fdisk.sh
[root@iZ23wv7v5ggZ ~]# ./auto_fdisk.sh

#######################################################################
#       OneinStack for CentOS/RedHat 5+ Debian 6+ and Ubuntu 12+      #
#                             Auto fdisk                              #
#       For more information please visit http://oneinstack.com       #
#######################################################################

Step 1.No lock file, begin to create lock file and continue

Step 2.Begin to check free disk
You have a free disk, Now will fdisk it and mount it
This system have free disk :
/dev/vdb

Step 3.Begin to fdisk free disk

Step 4.Begin to make directory

Please enter a location to mount (Default directory: /data): 

Step 5.Begin to write configuration to /etc/fstab and mount device

Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        486M     0  486M   0% /dev
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           496M  436K  496M   1% /run
tmpfs           496M     0  496M   0% /sys/fs/cgroup
/dev/vda1        20G  1.8G   17G  10% /
tmpfs           100M     0  100M   0% /run/user/0
/dev/vdb1        40G   49M   38G   1% /data


14、打开网址:https://oneinstack.com/auto/ ,基于 OneinStack 的自动安装,选择了 LNMP,PHP 版本 7.4,复制安装命令,如图16
打开网址:https://oneinstack.com/auto/ ,基于 OneinStack 的自动安装,选择了 LNMP,PHP 版本 7.4,复制安装命令

图16

15、启动 ECS 实例后,基于 Xshell 6 进入 CentOS 服务器中,粘贴执行安装命令,如图17
启动 ECS 实例后,基于 Xshell 6 进入 CentOS 服务器中,粘贴执行安装命令

图17

16、打开网址:http://121.40.248.29 ,其为 ECS 的公网IP:121.40.248.29,参考添加虚拟主机的文档教程,添加虚拟主机:www.shuijingwanwq.com,如图18
打开网址:http://121.40.248.29 ,其为 ECS 的公网IP:121.40.248.29,参考添加虚拟主机的文档教程,添加虚拟主机:www.shuijingwanwq.com

图18



[root@iZ23wv7v5ggZ ~]# ls
auto_fdisk.sh  oneinstack  oneinstack-full.tar.gz
[root@iZ23wv7v5ggZ ~]# cd oneinstack
[root@iZ23wv7v5ggZ oneinstack]# ./vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
	1. Use HTTP Only
	2. Use your own SSL Certificate and Key
	3. Use Let's Encrypt to Create SSL Certificate and Key
	q. Exit
Please input the correct option: 3

Please input domain(example: www.example.com): www.shuijingwanwq.com
domain=www.shuijingwanwq.com

Please input the directory for the domain:www.shuijingwanwq.com :
(Default directory: /data/wwwroot/www.shuijingwanwq.com): 
Virtual Host Directory=/data/wwwroot/www.shuijingwanwq.com

Create Virtul Host directory......
set permissions of Virtual Host directory......

Do you want to add more domain name? [y/n]: y

Type domainname or IP(example: example.com other.example.com): shuijingwanwq.com
domain list=shuijingwanwq.com

Do you want to redirect from shuijingwanwq.com to www.shuijingwanwq.com? [y/n]: y

Do you want to redirect all HTTP requests to HTTPS? [y/n]: y
[Thu Dec  5 13:42:04 CST 2019] Create account key ok.
[Thu Dec  5 13:42:04 CST 2019] Registering account
[Thu Dec  5 13:42:06 CST 2019] Registered
[Thu Dec  5 13:42:06 CST 2019] ACCOUNT_THUMBPRINT='YjoQ78tWzIgLHz3s7fhC7IoepTPjD3tKvXNrLwE417w'
[Thu Dec  5 13:42:06 CST 2019] Creating domain key
[Thu Dec  5 13:42:06 CST 2019] The domain key is here: /root/.acme.sh/www.shuijingwanwq.com/www.shuijingwanwq.com.key
[Thu Dec  5 13:42:06 CST 2019] Multi domain='DNS:www.shuijingwanwq.com,DNS:shuijingwanwq.com'
[Thu Dec  5 13:42:06 CST 2019] Getting domain auth token for each domain
[Thu Dec  5 13:42:09 CST 2019] Getting webroot for domain='www.shuijingwanwq.com'
[Thu Dec  5 13:42:09 CST 2019] Getting webroot for domain='shuijingwanwq.com'
[Thu Dec  5 13:42:10 CST 2019] Verifying: www.shuijingwanwq.com
[Thu Dec  5 13:42:13 CST 2019] Success
[Thu Dec  5 13:42:13 CST 2019] Verifying: shuijingwanwq.com
[Thu Dec  5 13:42:17 CST 2019] Success
[Thu Dec  5 13:42:17 CST 2019] Verify finished, start to sign.
[Thu Dec  5 13:42:17 CST 2019] Lets finalize the order, Le_OrderFinalize: https://acme-v02.api.letsencrypt.org/acme/finalize/73156074/1675742914
[Thu Dec  5 13:42:19 CST 2019] Download cert, Le_LinkCert: https://acme-v02.api.letsencrypt.org/acme/cert/03c589a531a1436b28e9162b53022c7e4bdd
[Thu Dec  5 13:42:20 CST 2019] Cert success.
-----BEGIN CERTIFICATE-----
MIIFdTCCBF2gAwIBAgISA8WJpTGhQ2so6RYrUwIsfkvdMA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTEyMDUwNDQyMThaFw0y
MDAzMDQwNDQyMThaMCAxHjAcBgNVBAMTFXd3dy5zaHVpamluZ3dhbndxLmNvbTCC
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL5uSUG5EB2t482PVg3oXQ3W
1op5ZZph6c1Mgw+pugTM3GW7R+eR/au1FcSJUoSZhA9/Yvps27/B7jafVS6MrDYv
6l2vj9aqXuXqoto2DMrqCd7h11x3V+W55/pODaqTG3b8LPaWXcqoDQ1830R+XqDU
+/L29x0nunc6JYJmHrDMx1OU9cticXPaUV+/GLGvgh6JOF8Xn9IAIczvlJuu5Sak
umEEDsIft0GI78WSHgx2onT6KIBSBFWMWDtgOAhiaIjlUww/Qg11YjQMfDaaaFYo
Etg0b9qWz0MIZl7J+87dmy8uHvWlO3Ph7V5s4pdHCv+Y7AAXvn0SpRrb15RwYxMC
AwEAAaOCAn0wggJ5MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcD
AQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUP+gvTkg2uTXmuKEc
JvqozkFfXsMwHwYDVR0jBBgwFoAUqEpqYwR93brm0Tm3pkVl7/Oo7KEwbwYIKwYB
BQUHAQEEYzBhMC4GCCsGAQUFBzABhiJodHRwOi8vb2NzcC5pbnQteDMubGV0c2Vu
Y3J5cHQub3JnMC8GCCsGAQUFBzAChiNodHRwOi8vY2VydC5pbnQteDMubGV0c2Vu
Y3J5cHQub3JnLzAzBgNVHREELDAqghFzaHVpamluZ3dhbndxLmNvbYIVd3d3LnNo
dWlqaW5nd2Fud3EuY29tMEwGA1UdIARFMEMwCAYGZ4EMAQIBMDcGCysGAQQBgt8T
AQEBMCgwJgYIKwYBBQUHAgEWGmh0dHA6Ly9jcHMubGV0c2VuY3J5cHQub3JnMIIB
BAYKKwYBBAHWeQIEAgSB9QSB8gDwAHYAb1N2rDHwMRnYmQCkURX/dxUcEdkCwQAp
Bo2yCJo32RMAAAFu1JSaBQAABAMARzBFAiEAjyN2kk8UHD+chH/Lpb0m0Ve0ORc6
tEwbx0/1rt0bBBYCIF3JMCisI70bNmHpIWcvirwBM0+1t6Yyy5b+xA65v6/BAHYA
B7dcG+V9aP/xsMYdIxXHuuZXfFeUt2ruvGE6GmnTohwAAAFu1JSZ/gAABAMARzBF
AiB4wGj9xD+Yj4Szu5yAb6/266KPSX2QxIL1J6YSyOSq+AIhAIZe0ii2cOvUn9Wb
gE2RmVXOKohPp8cmqR9OfRK7icBUMA0GCSqGSIb3DQEBCwUAA4IBAQB+8IQ0C4Zj
nDHy69nQ9hv2DnpWA20v8efPIr+mxmmESGZo3DlZBkzbuWgFB3ObpX2rYhzVm9gK
awDUZ4RI4CBG2JvzDhib7/C9OBSLQ4ZWxwPtwrGygACslBZ5t1hb531SawFd3PKf
CZBAa80oF52D//M2l0yoaCzoCcckih8t3MH1ehKQQMvYGaEjMuhtcBm1Z830YWzY
jmdIasyeSn5ErrgKW3asBgBnhO9U6fngot8HqUFU3stj0mAs5b2rumAHhgH1cvh3
AfXkQSnFh+MLErarwW92oxM7dDIiT3AHY4RAXM/uBMNTTMu8n01g9RW2zZo+a7wB
zyCDzi3YL8Bp
-----END CERTIFICATE-----
[Thu Dec  5 13:42:20 CST 2019] Your cert is in  /root/.acme.sh/www.shuijingwanwq.com/www.shuijingwanwq.com.cer 
[Thu Dec  5 13:42:20 CST 2019] Your cert key is in  /root/.acme.sh/www.shuijingwanwq.com/www.shuijingwanwq.com.key 
[Thu Dec  5 13:42:20 CST 2019] The intermediate CA cert is in  /root/.acme.sh/www.shuijingwanwq.com/ca.cer 
[Thu Dec  5 13:42:20 CST 2019] And the full chain certs is there:  /root/.acme.sh/www.shuijingwanwq.com/fullchain.cer 

Do you want to add hotlink protection? [y/n]: n

Allow Rewrite rule? [y/n]: y

Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog,whmcs rewrite was exist.
(Default rewrite: other): wordpress
You choose rewrite=wordpress

Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
You access log file=/data/wwwlogs/www.shuijingwanwq.com_nginx.log

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......

#######################################################################
#       OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+      #
#       For more information please visit https://oneinstack.com      #
#######################################################################
Your domain:                  www.shuijingwanwq.com
Virtualhost conf:             /usr/local/nginx/conf/vhost/www.shuijingwanwq.com.conf
Directory of:                 /data/wwwroot/www.shuijingwanwq.com
Rewrite rule:                 /usr/local/nginx/conf/rewrite/wordpress.conf
Let's Encrypt SSL Certificate:/usr/local/nginx/conf/ssl/www.shuijingwanwq.com.crt
SSL Private Key:              /usr/local/nginx/conf/ssl/www.shuijingwanwq.com.key


17、管理FTP帐号,添加FTP帐号:www.shuijingwanwq.com,如图19
管理FTP帐号,添加FTP帐号:www.shuijingwanwq.com

图19



[root@iZ23wv7v5ggZ oneinstack]# ./pureftpd_vhost.sh

#######################################################################
#       OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+      #
#                 FTP virtual user account management                 #
#       For more information please visit https://oneinstack.com      #
#######################################################################

What Are You Doing?
	1. UserAdd
	2. UserMod
	3. UserPasswd
	4. UserDel
	5. ListAllUser
	6. ShowUser
	q. Exit
Please input the correct option: 5
User was not existed! 

What Are You Doing?
	1. UserAdd
	2. UserMod
	3. UserPasswd
	4. UserDel
	5. ListAllUser
	6. ShowUser
	q. Exit
Please input the correct option: 1

Please input a username: www.shuijingwanwq.com

Please input the password: 

Please input the directory(Default directory: /data/wwwroot): /data/wwwroot/www.shuijingwanwq.com
Password: 
Enter it again: 
#####################################

[www.shuijingwanwq.com] create successful! 

You user name is : www.shuijingwanwq.com
You Password is : 
You directory is : /data/wwwroot/www.shuijingwanwq.com


What Are You Doing?
	1. UserAdd
	2. UserMod
	3. UserPasswd
	4. UserDel
	5. ListAllUser
	6. ShowUser
	q. Exit
Please input the correct option: q
[root@iZ23wv7v5ggZ oneinstack]# 



18、管理 RDS,创建帐号:shuijingwanwq,如图20
管理 RDS,创建帐号:shuijingwanwq

图20

19、管理 RDS,新建数据库:shuijingwanwq,字符集:utf8mb4,如图21
管理 RDS,新建数据库:shuijingwanwq,字符集:utf8mb4

图21

20、基本信息,设置白名单后才显示内网地址,如图22
基本信息,设置白名单后才显示内网地址

图22

21、添加白名单分组,其值来源于 ECS 的内网IP,如图23
添加白名单分组,其值来源于 ECS 的内网IP

图23

22、基本信息,内网地址已经显示,如图24
基本信息,内网地址已经显示

图24

23、登录数据库,如图25
登录数据库

图25

24、数据方案 – 导入 – 新增任务 – 导入 SQL 文件:shuijingwanwq.sql,如图26
数据方案 - 导入 - 新增任务 - 导入 SQL 文件:shuijingwanwq.sql

图26

25、导入完成, 成功执行SQL数:385,耗时:8412ms,如图27
导入完成, 成功执行SQL数:385,耗时:8412ms

图27

26、刷新数据库,查看表,已经成功导入,如图28
刷新数据库,查看表,已经成功导入

图28

27、编辑文件:wp-config.php,将 MySQL 主机 的值调整为:RDS 的内网地址,其他配置不变,如图29
编辑文件:wp-config.php,将 MySQL 主机 的值调整为:RDS 的内网地址,其他配置不变

图29

28、基于 FlashFXP ,在站点管理器中新建站点,如图30
基于 FlashFXP ,在站点管理器中新建站点

图30

29、基于 FlashFXP ,连接至 FTP 服务器中,将解压后的程序文件上传,如图31
基于 FlashFXP ,连接至 FTP 服务器中,将解压后的程序文件上传

图31

30、打开网址:shuijingwanwq.com, 以测试是否自动跳转至 www.shuijingwanwq.com,最终打开网址:https://www.shuijingwanwq.com/ ,符合预期,且已经支持 HTTPS,如图32
打开网址:shuijingwanwq.com, 以测试是否自动跳转至 www.shuijingwanwq.com,最终打开网址:https://www.shuijingwanwq.com/ ,符合预期,且已经支持 HTTPS

图32

31、之前由于 PHP 的版本:5.4.15,导致程序不能够升级至:WordPress 5.3,因为其要求的 PHP 的版本为:5.6.20,如图33
之前由于 PHP 的版本:5.4.15,导致程序不能够升级至:WordPress 5.3,因为其要求的 PHP 的版本为:5.6.20

图33

32、现在 PHP 的版本:7.4.0,现在已经可以正常升级,如图34
现在 PHP 的版本:7.4.0,现在已经可以正常升级

图34

33、WordPress更新,您使用的WordPress是最新版本。 将来的安全更新将被自动安装。插件、主题、翻译均为最新版本。如图35
WordPress更新,您使用的WordPress是最新版本。 将来的安全更新将被自动安装。插件、主题、翻译均为最新版本。

图35

]]>
https://www.shuijingwanwq.com/2019/12/06/3670/feed/ 4