<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns="http://purl.org/rss/1.0/">
<channel rdf:about="https://www.rickw.cn/">
<title>Rick 's BLOG</title>
<link>https://www.rickw.cn/</link>
<description>Rick 's BLOG</description>
<dc:language>zh-cn</dc:language>
<dc:creator>redcheek@gmail.com</dc:creator>
<items>
<rdf:Seq>
<item rdf:about="https://www.rickw.cn/blogview/355">
<title><![CDATA[解决Windows10，11对zip、cab文件自动索引预览功能占用大量资源的方法]]></title>
	
<description><![CDATA[解决Windows10，11对zip、cab文件自动索引预览功能占用大量资源的方法：<br />
<br />
要在&nbsp;Windows&nbsp;11/10/8/7&nbsp;中禁用&nbsp;Windows&nbsp;内置&nbsp;Zip&nbsp;支持，您需要打开&nbsp;regedit&nbsp;并删除以下两个注册表项：&nbsp;<br />
<br />
要禁用对&nbsp;zip&nbsp;文件的支持，请删除此键：<br />]]></description>
<content:encoded><![CDATA[解决Windows10，11对zip、cab文件自动索引预览功能占用大量资源的方法：<br />
<br />
要在&nbsp;Windows&nbsp;11/10/8/7&nbsp;中禁用&nbsp;Windows&nbsp;内置&nbsp;Zip&nbsp;支持，您需要打开&nbsp;regedit&nbsp;并删除以下两个注册表项：&nbsp;<br />
<br />
要禁用对&nbsp;zip&nbsp;文件的支持，请删除此键：<br />
<br />
HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}&nbsp;<br />
<br />
要禁用对&nbsp;cab&nbsp;文件的支持，请删除此键：<br />
<br />
HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}&nbsp;<br />
<br />
rar/7z类型的删除下面的注册表项(WinRAR导致的)<br />
HKEY_CLASSES_ROOT\CLSID\{0C1FD748-B888-443D-9EC3-AD7E22D48808}<br />
<br />
重启电脑生效。<br />
<br />
Windows&nbsp;注册表可能不允许您轻松删除这些项。<br />
<br />
您可能需要拥有这些注册表项的所有权。然后添加当前用户的完全权限。<br />
<br />
<br />
低版本windows系统可以使用下面的命令：<br />
regsvr32&nbsp;/u&nbsp;zipfldr.dll<br />
<br />
]]></content:encoded>
<link>https://www.rickw.cn/blogview/355</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2026-01-13 22:44:09</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/354">
<title><![CDATA[Windows 11无法访问匿名共享的问题]]></title>
	
<description><![CDATA[‌1，禁用SMB客户端签名要求‌：（这一项确认一下，我这边的win11设置本身就是禁用）<br />
<br />
打开“组策略编辑器”（gpedit.msc）。<br />
导航到“计算机配置”&gt;“Windows&nbsp;设置”&gt;“安全设置”&gt;“本地策略”&gt;“安全选项”。<br />
双击“Microsoft网络客户端:对通信进行数字签名(始终)”，选择“禁用”。<br />]]></description>
<content:encoded><![CDATA[‌1，禁用SMB客户端签名要求‌：（这一项确认一下，我这边的win11设置本身就是禁用）<br />
<br />
打开“组策略编辑器”（gpedit.msc）。<br />
导航到“计算机配置”&gt;“Windows&nbsp;设置”&gt;“安全设置”&gt;“本地策略”&gt;“安全选项”。<br />
双击“Microsoft网络客户端:对通信进行数字签名(始终)”，选择“禁用”。<br />
<br />
‌2，启用不安全的来宾登录‌：<br />
<br />
打开“组策略编辑器”（gpedit.msc）。<br />
导航到“计算机配置”&gt;“管理模板”&gt;“网络”&gt;“Lanman&nbsp;工作站”。<br />
双击“启用不安全的来宾登录”，选择“启用”。<br />
<br />
<br />
我们这边实际上只修改了2。]]></content:encoded>
<link>https://www.rickw.cn/blogview/354</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-02-23 20:29:57</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/353">
<title><![CDATA[PHP 中单引号和双引号区别]]></title>
	
<description><![CDATA[PHP&nbsp;中单引号&nbsp;(')&nbsp;和双引号&nbsp;(")&nbsp;用来表示字符串。虽然它们看起来很相似，但在使用上却有一些重要区别。<br />
<br />
1.&nbsp;转义字符<br />
<br />
单引号：不支持转义字符。如果字符串中包含转义字符（如&nbsp;$&nbsp;或&nbsp;\&nbsp;），它们将被视为普通字符。<br />]]></description>
<content:encoded><![CDATA[PHP&nbsp;中单引号&nbsp;(')&nbsp;和双引号&nbsp;(")&nbsp;用来表示字符串。虽然它们看起来很相似，但在使用上却有一些重要区别。<br />
<br />
1.&nbsp;转义字符<br />
<br />
单引号：不支持转义字符。如果字符串中包含转义字符（如&nbsp;$&nbsp;或&nbsp;\&nbsp;），它们将被视为普通字符。<br />
<br />
双引号：支持转义字符。如果字符串中包含转义字符，它们将被解析为其对应的特殊字符。<br />
<br />
2.&nbsp;变量解析<br />
<br />
单引号：不支持变量解析。字符串中的任何变量引用都将被视为普通文本。<br />
<br />
双引号：支持变量解析。字符串中的变量引用将被替换为变量的实际值。<br />
<br />
3.&nbsp;性能<br />
<br />
一般来说，使用单引号的性能略优于使用双引号，因为不需要额外的转义或解析步骤。<br />
<br />
4.&nbsp;使用建议<br />
<br />
对于不包含转义字符或变量引用的简单字符串，使用单引号。<br />
对于包含转义字符或变量引用或需要复杂字符串的场景，使用双引号。]]></content:encoded>
<link>https://www.rickw.cn/blogview/353</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-15 14:28:42</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/352">
<title><![CDATA[关闭 Kdump 服务]]></title>
	
<description><![CDATA[Kdump服务可捕获内核错误，方便您对内核崩溃现象进行分析，但开启时也会占用部分内存。<br />
如下，物理内存是1GB（1024MB），实际有效物理内存只有803M，有221M被占用了。<br />
<div class="txt_main">#&nbsp;free&nbsp;-h<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;total&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;used&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;free&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shared&nbsp;&nbsp;buff/cache&nbsp;&nbsp;&nbsp;available<br />
Mem:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;803M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;267M&nbsp;</div><br />]]></description>
<content:encoded><![CDATA[Kdump服务可捕获内核错误，方便您对内核崩溃现象进行分析，但开启时也会占用部分内存。<br />
如下，物理内存是1GB（1024MB），实际有效物理内存只有803M，有221M被占用了。<br />
<div class="txt_main">#&nbsp;free&nbsp;-h<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;total&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;used&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;free&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shared&nbsp;&nbsp;buff/cache&nbsp;&nbsp;&nbsp;available<br />
Mem:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;803M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;267M&nbsp;</div><br />
<br />
禁用&nbsp;Kdump&nbsp;服务可以参考如下步骤：<br />
<br />
<ol type="1"><br />
<li>禁止&nbsp;Kdump&nbsp;服务：<div class="txt_main">systemctl&nbsp;stop&nbsp;kdump</div><br />
<li>禁止开机启动&nbsp;Kdump&nbsp;服务：<div class="txt_main">systemctl&nbsp;disable&nbsp;kdump</div><br />
<li>修改/etc/default/grub&nbsp;的配置，将&nbsp;GRUB_CMDLINE_LINUX&nbsp;中的&nbsp;crashkernel&nbsp;配置去掉。<div class="txt_main">vi&nbsp;/etc/default/grub&nbsp;</div><br />
<li>更新配置到启动文件：<div class="txt_main">grub2-mkconfig&nbsp;-o&nbsp;/boot/grub2/grub.cfg</div><br />
<li>重启机器生效。<div class="txt_main">reboot</div><br />
</ul></ol><br />
<br />
<br />
<br />
<br />
<br />
]]></content:encoded>
<link>https://www.rickw.cn/blogview/352</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-13 09:04:04</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/351">
<title><![CDATA[git 迁移仓库]]></title>
	
<description><![CDATA[要迁移一个Git仓库，您可以使用git&nbsp;clone命令配合--mirror选项来创建一个远程仓库的镜像。以下是步骤和示例代码：<br />
<br />
1，在当前终端中，使用git&nbsp;clone&nbsp;--mirror克隆远程仓库到本地。<br />
<br />
<div class="txt_main">git&nbsp;clone&nbsp;--mirror&nbsp;&lt;旧仓库URL&gt;</div><br />]]></description>
<content:encoded><![CDATA[要迁移一个Git仓库，您可以使用git&nbsp;clone命令配合--mirror选项来创建一个远程仓库的镜像。以下是步骤和示例代码：<br />
<br />
1，在当前终端中，使用git&nbsp;clone&nbsp;--mirror克隆远程仓库到本地。<br />
<br />
<div class="txt_main">git&nbsp;clone&nbsp;--mirror&nbsp;&lt;旧仓库URL&gt;</div><br />
2，进入刚刚克隆的仓库目录。<br />
<br />
<div class="txt_main">cd&nbsp;&lt;旧仓库名&gt;</div><br />
3，推送到新的远程仓库地址。<br />
<br />
<div class="txt_main">git&nbsp;push&nbsp;--mirror&nbsp;&lt;新仓库URL&gt;</div><br />
完成上述步骤后，旧仓库将被迁移到新的位置，包括所有的分支、标签和提交历史。]]></content:encoded>
<link>https://www.rickw.cn/blogview/351</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-08 11:13:56</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/350">
<title><![CDATA[crontab 定时格式]]></title>
	
<description><![CDATA[Cron&nbsp;是一个用于在&nbsp;Unix&nbsp;和&nbsp;Unix-like&nbsp;系统中进行定时任务的工具。<br />
<br />
Cron&nbsp;的主要目的是在某个时间点自动执行某些命令或程序。<br />
<br />
Cron&nbsp;的语法基本格式如下：<br />]]></description>
<content:encoded><![CDATA[Cron&nbsp;是一个用于在&nbsp;Unix&nbsp;和&nbsp;Unix-like&nbsp;系统中进行定时任务的工具。<br />
<br />
Cron&nbsp;的主要目的是在某个时间点自动执行某些命令或程序。<br />
<br />
Cron&nbsp;的语法基本格式如下：<br />
<br />
<div class="txt_main">*&nbsp;*&nbsp;*&nbsp;*&nbsp;*<br />
-&nbsp;-&nbsp;-&nbsp;-&nbsp;-<br />
|&nbsp;|&nbsp;|&nbsp;|&nbsp;|<br />
|&nbsp;|&nbsp;|&nbsp;|&nbsp;+----&nbsp;星期中日期值（0-7，星期日可以是0或7）<br />
|&nbsp;|&nbsp;|&nbsp;+------&nbsp;月份（1-12）<br />
|&nbsp;|&nbsp;+--------&nbsp;一个月中的日期（1-31）<br />
|&nbsp;+----------&nbsp;小时（0-23）<br />
+------------&nbsp;分钟（0-59）</div><br />
<br />
<img src="https://ask.qcloudimg.com/http-save/yehe-8115936/d4304e8d0f9fd452199e5f44e0f88f70.png" border="0" style="max-width:90%;height:auto;"  alt="按此在新窗口打开图片" onmouseover="this.style.cursor='hand';" onclick="showImage(this);" /><br />
<br />
在以上各个字段中，还可以使用以下特殊字符：<br />
&nbsp;星号（*）：代表所有可能的值，例如month字段如果是星号，则表示在满足其它字段的制约条件后每月都执行该命令操作。<br />
&nbsp;逗号（,）：可以用逗号隔开的值指定一个列表范围，例如，“1,2,5,7,8,9”<br />
&nbsp;中杠（-）：可以用整数之间的中杠表示一个整数范围，例如“2-6”表示“2,3,4,5,6”<br />
&nbsp;正斜线（/）：可以用正斜线指定时间的间隔频率，例如“0-23/2”表示每两小时执行一次。同时正斜线可以和星号一起使用，例如*/10，如果用在minute字段，表示每十分钟执行一次。<br />
<br />
每月1号凌晨2点执行命令：<br />
<div class="txt_main">0&nbsp;2&nbsp;1&nbsp;*&nbsp;*&nbsp;/path/command&nbsp;to&nbsp;be&nbsp;executed</div><br />
<br />
每小时的10分、20分、40分执行命令：<br />
<div class="txt_main">10,20,40&nbsp;*&nbsp;*&nbsp;*&nbsp;*&nbsp;/path/command&nbsp;to&nbsp;be&nbsp;executed</div><br />
<br />
每周一到周五，早上8点到17点的第30分执行命令：<br />
<div class="txt_main">30&nbsp;8-17&nbsp;*&nbsp;*&nbsp;1-5&nbsp;/path/command&nbsp;to&nbsp;be&nbsp;executed</div><br />
<br />
每天的0点、30分执行命令：<br />
<div class="txt_main">0,30&nbsp;0&nbsp;*&nbsp;*&nbsp;*&nbsp;/path/command&nbsp;to&nbsp;be&nbsp;executed</div><br />
]]></content:encoded>
<link>https://www.rickw.cn/blogview/350</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-07 11:01:45</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/349">
<title><![CDATA[Certbot 使用aliyun dns插件发行泛域名ssl证书并自动续期]]></title>
	
<description><![CDATA[<h2>原理</h2><br />
当我们使用&nbsp;certbot&nbsp;申请通配符证书时，需要手动添加&nbsp;TXT&nbsp;记录。每个&nbsp;certbot&nbsp;申请的证书有效期为&nbsp;3&nbsp;个月，虽然&nbsp;certbot&nbsp;提供了自动续期命令，但是当我们把自动续期命令配置为定时任务时，我们无法手动添加新的&nbsp;TXT&nbsp;记录用于&nbsp;certbot&nbsp;验证。<br />
<br />
好在&nbsp;certbot&nbsp;提供了一个&nbsp;hook，可以编写一个&nbsp;Shell&nbsp;脚本。在续期的时候让脚本调用&nbsp;DNS&nbsp;服务商的&nbsp;API&nbsp;接口动态添加&nbsp;TXT&nbsp;记录，验证完成后再删除此记录。<br />
<br />]]></description>
<content:encoded><![CDATA[<h2>原理</h2><br />
当我们使用&nbsp;certbot&nbsp;申请通配符证书时，需要手动添加&nbsp;TXT&nbsp;记录。每个&nbsp;certbot&nbsp;申请的证书有效期为&nbsp;3&nbsp;个月，虽然&nbsp;certbot&nbsp;提供了自动续期命令，但是当我们把自动续期命令配置为定时任务时，我们无法手动添加新的&nbsp;TXT&nbsp;记录用于&nbsp;certbot&nbsp;验证。<br />
<br />
好在&nbsp;certbot&nbsp;提供了一个&nbsp;hook，可以编写一个&nbsp;Shell&nbsp;脚本。在续期的时候让脚本调用&nbsp;DNS&nbsp;服务商的&nbsp;API&nbsp;接口动态添加&nbsp;TXT&nbsp;记录，验证完成后再删除此记录。<br />
<br />
<h2>安装命令行工具</h2><br />
<h4>1，安装&nbsp;aliyun&nbsp;cli&nbsp;工具</h4><br />
官方工具安全无忧。<br />
<div class="txt_main">wget&nbsp;https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz<br />
tar&nbsp;xzf&nbsp;aliyun-cli-linux-latest-amd64.tgz<br />
sudo&nbsp;cp&nbsp;aliyun&nbsp;/usr/local/bin<br />
</div><br />
安装完成后需要【配置凭证信息】：<br />
<div class="txt_main">#&nbsp;Configure&nbsp;Aliyun&nbsp;CLI<br />
aliyun&nbsp;configure&nbsp;set&nbsp;--profile&nbsp;akProfile&nbsp;--mode&nbsp;AK&nbsp;--region&nbsp;$REGION&nbsp;--access-key-id&nbsp;$ACCESS_KEY_ID&nbsp;--access-key-secret&nbsp;$ACCESS_KEY_SECRET<br />
</div><br />
$REGION&nbsp;是阿里云的服务器区域：cn-qingdao&nbsp;cn-beijing&nbsp;cn-hongkong&nbsp;等。<br />
更多请参考官网：https://help.aliyun.com/zh/ecs/regions-and-zones<br />
<br />
$ACCESS_KEY_ID&nbsp;和&nbsp;$ACCESS_KEY_SECRET&nbsp;需要在阿里云控制台申请。<br />
详情可以参考官网：https://help.aliyun.com/zh/cli/configure-credentials<br />
<br />
注意：要设置权限。实际是授权RAM用户管理云解析，所以授权时选择&nbsp;<font color="red">AliyunDNSFullAccess</font>&nbsp;而不是AliyunDomainFullAccess。<br />
<br />
<h4>2，安装&nbsp;certbot-dns-aliyun&nbsp;Hook脚本插件</h4><br />
shell脚本，安全透明。<br />
<div class="txt_main">wget&nbsp;https://cdn.jsdelivr.net/gh/justjavac/certbot-dns-aliyun@main/alidns.sh<br />
sudo&nbsp;cp&nbsp;alidns.sh&nbsp;/usr/local/bin/alidns<br />
sudo&nbsp;chmod&nbsp;+x&nbsp;/usr/local/bin/alidns<br />
</div><br />
<font color="red">因为是从第三方下载的脚本，下载后请审查脚本内容。脚本内容比较简单，审查很容易。</font><br />
<br />
<h4>3，申请泛域名证书</h4><br />
测试是否能正确申请：<br />
<div class="txt_main">certbot&nbsp;certonly&nbsp;-d&nbsp;*.rickw.cn&nbsp;-d&nbsp;rickw.cn&nbsp;--manual&nbsp;--preferred-challenges&nbsp;dns&nbsp;--manual-auth-hook&nbsp;"alidns"&nbsp;--manual-cleanup-hook&nbsp;"alidns&nbsp;clean"&nbsp;--dry-run</div><br />
如果aliyun权限问题，注意设置权限&nbsp;<font color="red">AliyunDNSFullAccess</font>。<br />
<br />
正式申请时去掉&nbsp;--dry-run&nbsp;参数：<br />
<div class="txt_main">certbot&nbsp;certonly&nbsp;-d&nbsp;*.rickw.cn&nbsp;-d&nbsp;rickw.cn&nbsp;--manual&nbsp;--preferred-challenges&nbsp;dns&nbsp;--manual-auth-hook&nbsp;"alidns"&nbsp;--manual-cleanup-hook&nbsp;"alidns&nbsp;clean"</div><br />
<br />
<h4>4，证书续期</h4><br />
<div class="txt_main">certbot&nbsp;renew&nbsp;--dry-run</div><br />
测试运行正常后去掉参数&nbsp;--dry-run&nbsp;即可。<br />
续期时不需要再指定其它参数，在申请证书时的参数都已经保存。续期时会自动读取参数。<br />
<br />
<h4>5，自动续期</h4><br />
CentOS8&nbsp;安装的来自epel仓库的certbot&nbsp;1.22版本，已经自动安装了系统定时事件。<br />
可以通过下面命令查看是否有certbot相关的定时事件。<br />
<div class="txt_main">systemctl&nbsp;list-timers</div><br />
<br />
另外在第三步正式申请时如果看到如下信息，也表示有自动定时事件。<br />
<div class="txt_main">Successfully&nbsp;received&nbsp;certificate.<br />
Certificate&nbsp;is&nbsp;saved&nbsp;at:&nbsp;/etc/letsencrypt/live/rickw.cn/fullchain.pem<br />
Key&nbsp;is&nbsp;saved&nbsp;at:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/etc/letsencrypt/live/rickw.cn/privkey.pem<br />
This&nbsp;certificate&nbsp;expires&nbsp;on&nbsp;2025-04-06.<br />
These&nbsp;files&nbsp;will&nbsp;be&nbsp;updated&nbsp;when&nbsp;the&nbsp;certificate&nbsp;renews.<br />
<font color="red">Certbot&nbsp;has&nbsp;set&nbsp;up&nbsp;a&nbsp;scheduled&nbsp;task&nbsp;to&nbsp;automatically&nbsp;renew&nbsp;this&nbsp;certificate&nbsp;in&nbsp;the&nbsp;background.</font><br />
</div><br />
<br />
如果没有的话，可以手动添加定时任务。<br />
可以参考之前的文章<a target="_blank" href="/blogview/287">【CentOS&nbsp;+&nbsp;Nginx&nbsp;如何自动申请部署Let's&nbsp;Encrypt免费SSL证书】</a><br />
<br />
]]></content:encoded>
<link>https://www.rickw.cn/blogview/349</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-06 12:57:18</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/348">
<title><![CDATA[CentOS7、8转换使用Oracle的yum仓库]]></title>
	
<description><![CDATA[首先导入&nbsp;oracle的&nbsp;GPG&nbsp;key。<br />
<br />
CentOS7&nbsp;首先导入&nbsp;oracle的&nbsp;GPG&nbsp;key。<br />
<div class="txt_main">#&nbsp;wget&nbsp;https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7&nbsp;-O&nbsp;/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;gpg&nbsp;--quiet&nbsp;--with-fingerprint&nbsp;/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pub&nbsp;&nbsp;2048R/EC551F03&nbsp;2010-07-01&nbsp;Oracle&nbsp;OSS&nbsp;group&nbsp;(Open&nbsp;Source&nbsp;Software&nbsp;group)&nbsp;&lt;build@oss.oracle.com&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Key&nbsp;fingerprint&nbsp;=&nbsp;4214&nbsp;4123&nbsp;FECF&nbsp;C55B&nbsp;9086&nbsp;&nbsp;313D&nbsp;72F9&nbsp;7B74&nbsp;EC55&nbsp;1F03<br />
</div><br />
]]></description>
<content:encoded><![CDATA[首先导入&nbsp;oracle的&nbsp;GPG&nbsp;key。<br />
<br />
CentOS7&nbsp;首先导入&nbsp;oracle的&nbsp;GPG&nbsp;key。<br />
<div class="txt_main">#&nbsp;wget&nbsp;https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7&nbsp;-O&nbsp;/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;gpg&nbsp;--quiet&nbsp;--with-fingerprint&nbsp;/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pub&nbsp;&nbsp;2048R/EC551F03&nbsp;2010-07-01&nbsp;Oracle&nbsp;OSS&nbsp;group&nbsp;(Open&nbsp;Source&nbsp;Software&nbsp;group)&nbsp;&lt;build@oss.oracle.com&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Key&nbsp;fingerprint&nbsp;=&nbsp;4214&nbsp;4123&nbsp;FECF&nbsp;C55B&nbsp;9086&nbsp;&nbsp;313D&nbsp;72F9&nbsp;7B74&nbsp;EC55&nbsp;1F03<br />
</div><br />
<br />
CentOS7创建临时仓库文件<br />
vi&nbsp;/etc/yum.repos.d/ol7-temp.repo&nbsp;<br />
<div class="txt_main">[ol7_latest]<br />
name=Oracle&nbsp;Linux&nbsp;$releasever&nbsp;Latest&nbsp;($basearch)<br />
baseurl=https://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/<br />
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
gpgcheck=1<br />
enabled=1<br />
</div><br />
<br />
安装甲骨文的仓库源<br />
<div class="txt_main">&nbsp;yum&nbsp;install&nbsp;oraclelinux-release-el7</div><br />
<br />
然后禁用临时仓库，删除CentOS自带的仓库文件。<br />
<div class="txt_main">&nbsp;mv&nbsp;/etc/yum.repos.d/ol7-temp.repo&nbsp;/etc/yum.repos.d/ol7-temp.repo.disabled&nbsp;</div><br />
<br />
CentOS8&nbsp;首先导入&nbsp;oracle的&nbsp;GPG&nbsp;key。<br />
<div class="txt_main">wget&nbsp;https://yum.oracle.com/RPM-GPG-KEY-oracle-ol8&nbsp;-O&nbsp;/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;gpg&nbsp;--import&nbsp;--import-options&nbsp;show-only&nbsp;/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pub&nbsp;&nbsp;&nbsp;rsa4096&nbsp;2019-04-09&nbsp;[SC]&nbsp;[expires:&nbsp;2039-04-04]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;76FD3DB13AB67410B89DB10E82562EA9AD986DA3<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Oracle&nbsp;OSS&nbsp;group&nbsp;(Open&nbsp;Source&nbsp;Software&nbsp;group)&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sub&nbsp;&nbsp;&nbsp;rsa4096&nbsp;2019-04-09&nbsp;[E]&nbsp;[expires:&nbsp;2039-04-04]<br />
</div><br />
<br />
创建临时仓库文件<br />
vi&nbsp;/etc/yum.repos.d/ol8-temp.repo<br />
<div class="txt_main">[ol8_baseos_latest]<br />
name=Oracle&nbsp;Linux&nbsp;8&nbsp;BaseOS&nbsp;Latest&nbsp;($basearch)<br />
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/$basearch/<br />
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle<br />
gpgcheck=1<br />
enabled=1<br />
</div><br />
<br />
安装甲骨文的仓库源<br />
<div class="txt_main">dnf&nbsp;install&nbsp;oraclelinux-release-el8</div><br />
<br />
然后禁用临时仓库，删除CentOS8自带的仓库文件。<br />
<div class="txt_main">mv&nbsp;/etc/yum.repos.d/ol8-temp.repo&nbsp;/etc/yum.repos.d/ol8-temp.repo.disabled</div><br />
<br />
<br />
<br />
]]></content:encoded>
<link>https://www.rickw.cn/blogview/348</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-05 08:43:34</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/347">
<title><![CDATA[安装php8.4后配置php84 fpm和nginx]]></title>
	
<description><![CDATA[之前的文章中介绍了<a target="_blank" href="/blogview/346">Alibaba&nbsp;Cloud&nbsp;Linux&nbsp;3&nbsp;中使用yum安装&nbsp;php8.4</a><br />
<br />
安装完成后还需要配置php84-php-fpm以及nginx对应的upstream参数。<br />
<br />
首先我们需要php84安装的位置以及对应配置文件的位置。<br />]]></description>
<content:encoded><![CDATA[之前的文章中介绍了<a target="_blank" href="/blogview/346">Alibaba&nbsp;Cloud&nbsp;Linux&nbsp;3&nbsp;中使用yum安装&nbsp;php8.4</a><br />
<br />
安装完成后还需要配置php84-php-fpm以及nginx对应的upstream参数。<br />
<br />
首先我们需要php84安装的位置以及对应配置文件的位置。<br />
<br />
<h3>查找php84的位置</h3><br />
1，比较暴力的方法<br />
<div class="txt_main">find&nbsp;/&nbsp;|&nbsp;grep&nbsp;php-fpm</div><br />
根据上面的搜索结果我们可以确定位置。<br />
<br />
2，通过php84-php-fpm服务的状态<br />
<div class="txt_main">systemctl&nbsp;start&nbsp;php84-php-fpm<br />
systemctl&nbsp;status&nbsp;php84-php-fpm<br />
</div><br />
<div class="code_head"></div><div class="code_main quote"><blockquote>●&nbsp;php84-php-fpm.service&nbsp;-&nbsp;The&nbsp;PHP&nbsp;FastCGI&nbsp;Process&nbsp;Manager<br />
&nbsp;&nbsp;&nbsp;Loaded:&nbsp;loaded&nbsp;(/usr/lib/systemd/system/php84-php-fpm.service;&nbsp;enabled;&nbsp;vendor&nbsp;preset:&nbsp;enabled)<br />
&nbsp;&nbsp;&nbsp;Active:&nbsp;active&nbsp;(running)&nbsp;since&nbsp;Sun&nbsp;2024-12-29&nbsp;19:13:38&nbsp;CST;&nbsp;22h&nbsp;ago<br />
&nbsp;Main&nbsp;PID:&nbsp;2356&nbsp;(php-fpm)<br />
&nbsp;&nbsp;&nbsp;Status:&nbsp;"Processes&nbsp;active:&nbsp;0,&nbsp;idle:&nbsp;5,&nbsp;Requests:&nbsp;75,&nbsp;slow:&nbsp;0,&nbsp;Traffic:&nbsp;0.00req/sec"<br />
&nbsp;&nbsp;&nbsp;&nbsp;Tasks:&nbsp;6&nbsp;(limit:&nbsp;11862)<br />
&nbsp;&nbsp;&nbsp;Memory:&nbsp;29.3M<br />
&nbsp;&nbsp;&nbsp;CGroup:&nbsp;/system.slice/php84-php-fpm.service<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├─2356&nbsp;php-fpm:&nbsp;master&nbsp;process&nbsp;(/etc/opt/remi/php84/php-fpm.conf)<br />
</blockquote></div><br />
<br />
通过上面的信息可以可以确定fpm配置文件的位置。<br />
<br />
<h3>配置&nbsp;nginx&nbsp;对应php84&nbsp;fpm的upstream</h3><br />
首先我们需要知道&nbsp;php84&nbsp;fpm的监听地址。<br />
查看文件&nbsp;/etc/opt/remi/php84/php-fpm.d/www.conf<br />
<div class="txt_main">listen&nbsp;=&nbsp;/var/opt/remi/php84/run/php-fpm/www.sock</div><br />
<br />
然后在nginx中添加php84&nbsp;fpm对应的upstream。<br />
新建文件&nbsp;/etc/nginx/conf.d/php84-fpm.conf，文件内容如下：<br />
<div class="txt_main">upstream&nbsp;php84-fpm&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;unix:/var/opt/remi/php84/run/php-fpm/www.sock;<br />
}<br />
</div><br />
<br />
在需要使用php84的网站配置中修改&nbsp;fastcgi_pass&nbsp;&nbsp;&nbsp;参数；<br />
<div class="txt_main">fastcgi_pass&nbsp;&nbsp;&nbsp;php84-fpm;</div><br />
这样nginx的修改基本完成了。<br />
测试配置是否正确，如果没有问题重新加载配置。<br />
<div class="txt_main">nginx&nbsp;-t<br />
nginx&nbsp;-s&nbsp;reload</div><br />
<br />
<h3>权限问题修正</h3><br />
访问网站时发生异常。通过查看nginx的错误日志。<br />
<div class="txt_main">connect()&nbsp;to&nbsp;unix:/var/opt/remi/php84/run/php-fpm/www.sock&nbsp;failed&nbsp;(13:&nbsp;Permission&nbsp;denied)</div><br />
<br />
权限有问题，fpm默认是以apache用户启动，nginx是以nginx用户启动。增加nginx用户的权限即可。<br />
修改&nbsp;/etc/opt/remi/php84/php-fpm.d/www.conf&nbsp;文件，增加红色部分内容：<br />
<div class="txt_main">listen.acl_users&nbsp;=&nbsp;apache<font color="red">,nginx</font></div><br />
<br />
如果不用unix&nbsp;socket，直接使用端口号也是可以的。这样就不用修改这个权限配置。<br />
<br />
如果是初次使用端口号，也有可能会出现权限问题。<br />
<div class="txt_main">connect()&nbsp;to&nbsp;127.0.0.1:8080&nbsp;failed&nbsp;(13:&nbsp;Permission&nbsp;denied)</div><br />
<br />
这个是selinux权限问题。<br />
<br />
可以参考之前的文章<a target="_blank" href="/blogview/241">【nginx反向代理出现502错误】</a>进行权限调整。]]></content:encoded>
<link>https://www.rickw.cn/blogview/347</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-03 10:26:11</dc:date>
</item>
		
<item rdf:about="https://www.rickw.cn/blogview/346">
<title><![CDATA[Alibaba Cloud Linux 3 中使用yum安装 php8.4]]></title>
	
<description><![CDATA[之前文章介绍了<a target="_blank" href="/blogview/342">在CentOS7/8中使用yum安装php7、php8</a>。<br />
<br />
Alibaba&nbsp;Cloud&nbsp;Linux&nbsp;3的内置仓库中包含了php7的发行版本，可以直接使用yum来安装php7。<br />
<br />
Alibaba&nbsp;Cloud&nbsp;Linux&nbsp;3是基于Anolis&nbsp;OS&nbsp;8构建的，它与CentOS&nbsp;8及RHEL&nbsp;8生态完全兼容。<br />]]></description>
<content:encoded><![CDATA[之前文章介绍了<a target="_blank" href="/blogview/342">在CentOS7/8中使用yum安装php7、php8</a>。<br />
<br />
Alibaba&nbsp;Cloud&nbsp;Linux&nbsp;3的内置仓库中包含了php7的发行版本，可以直接使用yum来安装php7。<br />
<br />
Alibaba&nbsp;Cloud&nbsp;Linux&nbsp;3是基于Anolis&nbsp;OS&nbsp;8构建的，它与CentOS&nbsp;8及RHEL&nbsp;8生态完全兼容。<br />
<br />
这样就简单了，可以参照CentOS8的方式操作，当然还是有一些细节修正。<br />
<br />
<h2>1，首先安装外部源</h2><br />
<div class="txt_main">rpm&nbsp;-ivh&nbsp;--nodeps&nbsp;https://rpms.remirepo.net/enterprise/remi-release-8.rpm</div><br />
<br />
<h2>2，进行修正</h2><br />
对于CentOS8到这里就可以正常工作了。<br />
但是这里会报错：<br />
<div class="txt_main">Errors&nbsp;during&nbsp;downloading&nbsp;metadata&nbsp;for&nbsp;repository&nbsp;'remi-modular':<br />
<br />
-Status&nbsp;code:&nbsp;403&nbsp;for&nbsp;http://cdn.remirepo.net/enterprise/<font color="red">3</font>/modular/x86_64/mirror&nbsp;(IP:&nbsp;109.238.14.107)<br />
<br />
Error:&nbsp;Failed&nbsp;to&nbsp;download&nbsp;metadata&nbsp;for&nbsp;repo&nbsp;'remi-modular':&nbsp;Cannot&nbsp;prepare&nbsp;internal&nbsp;mirrorlist:&nbsp;Status&nbsp;code:&nbsp;403&nbsp;for&nbsp;http://cdn.remirepo.net/enterprise/<font color="red">3</font>/modular/x86_64/mirror&nbsp;(IP:&nbsp;109.238.14.107)<br />
</div><br />
<br />
出问题的原因就是上面地址中红色的3不正确。<br />
<br />
在仓库配置文件中链接地址使用了系统变量$releasever，这个变量在CentOS8中是8，在这里是3，所以出现问题。<br />
我们只需要将配置文件中的$releasever替换为8即可。<br />
<br />
<div class="txt_main">sed&nbsp;-i&nbsp;'s/$releasever/8/g'&nbsp;/etc/yum.repos.d/remi-modular.repo<br />
sed&nbsp;-i&nbsp;'s/$releasever/8/g'&nbsp;/etc/yum.repos.d/remi-safe.repo<br />
</div><br />
<br />
<h2>3，安装php8.4</h2><br />
<div class="txt_main">yum&nbsp;install&nbsp;php84&nbsp;php84-php&nbsp;php84-php-fpm&nbsp;php84-php-mbstring&nbsp;php84-php-mysqlnd&nbsp;php84-php-intl&nbsp;php84-php-gd&nbsp;php84-php-bcmath&nbsp;php84-php-sodium&nbsp;php84-php-xz&nbsp;</div><br />
<br />
]]></content:encoded>
<link>https://www.rickw.cn/blogview/346</link>
<dc:subject>其它运维与编程</dc:subject>
<dc:creator>rick</dc:creator>
<dc:date>2025-01-02 08:25:26</dc:date>
</item>
		
</rdf:Seq>
</items>
</channel>
</rdf:RDF>