<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>阿里云安全组端口 &#8211; 外贸服务器代维护工作室</title>
	<atom:link href="https://www.fuwuqi120.com/tag/%e9%98%bf%e9%87%8c%e4%ba%91%e5%ae%89%e5%85%a8%e7%bb%84%e7%ab%af%e5%8f%a3/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fuwuqi120.com</link>
	<description>｜外贸网站服务器代维：阿里云 ECS、AWS EC2、Linux、宝塔面板、WordPress 独立站托管与排障。</description>
	<lastBuildDate>Thu, 26 Nov 2026 20:02:53 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>防火墙或 SELinux 阻止怎么查</title>
		<link>https://www.fuwuqi120.com/%e9%98%b2%e7%81%ab%e5%a2%99%e6%88%96-selinux-%e9%98%bb%e6%ad%a2%e6%80%8e%e4%b9%88%e6%9f%a5/</link>
					<comments>https://www.fuwuqi120.com/%e9%98%b2%e7%81%ab%e5%a2%99%e6%88%96-selinux-%e9%98%bb%e6%ad%a2%e6%80%8e%e4%b9%88%e6%9f%a5/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 26 Nov 2026 20:02:52 +0000</pubDate>
				<category><![CDATA[服务器安全设置]]></category>
		<category><![CDATA[AWS Security Group]]></category>
		<category><![CDATA[WordPress 502]]></category>
		<category><![CDATA[外贸独立站打不开]]></category>
		<category><![CDATA[防火墙或 SELinux 阻止]]></category>
		<category><![CDATA[阿里云安全组端口]]></category>
		<guid isPermaLink="false">https://www.fuwuqi120.com/%e9%98%b2%e7%81%ab%e5%a2%99%e6%88%96-selinux-%e9%98%bb%e6%ad%a2%e6%80%8e%e4%b9%88%e6%9f%a5/</guid>

					<description><![CDATA[海外客户打不开、后台 502 或支付回调失败，先按云安全组、系统防火墙、SELinux 三层查；别一上来关防护，先确认端口、进程和拒绝日志。]]></description>
										<content:encoded><![CDATA[<div class="fuwuqi120-answer">
<p><strong>一句话答案：</strong>海外客户打不开、后台 502 或支付回调失败，先按云安全组、系统防火墙、SELinux 三层查；别一上来关防护，先确认端口、进程和拒绝日志。</p>
</div>
<div class="fuwuqi120-toc">
<p><strong>本文目录</strong></p>
<ol>
<li><a href="#fuwuqi120-h2-1">先给结论：三类拦截，别混着查</a></li>
<li><a href="#fuwuqi120-h2-2">它是什么：拦截发生在网站之前或之后</a></li>
<li><a href="#fuwuqi120-h2-3">能解决什么问题：访问、回调和后台异常</a></li>
<li><a href="#fuwuqi120-h2-4">具体怎么做一：30 秒判断加端口放行</a></li>
<li><a href="#fuwuqi120-h2-5">具体怎么做二：SELinux 用日志修，不直接关</a></li>
<li><a href="#fuwuqi120-h2-6">注意什么：改完要复测，别把门全打开</a></li>
</ol>
</div>
<h2 id="fuwuqi120-h2-1">先给结论：三类拦截，别混着查</h2>
<p><strong>三类拦截要分开查：云安全组、系统防火墙、SELinux，别混着关。</strong>我接<a href="https://www.fuwuqi120.com/tag/%e5%a4%96%e8%b4%b8%e7%8b%ac%e7%ab%8b%e7%ab%99/">外贸独立站</a>故障，第一件事就是分层。任何一层拒绝，前台表现都差不多：欧美客户浏览器转圈超时，东南亚时好时坏，PayPal / Stripe 的回调 POST 静默丢掉，后台偶尔蹦 502。看着像线路问题，实际包根本没到 Nginx。</p>
<p>30 秒先定性。办公室电脑跑一条，服务器同时跑一条，两边对照看，不用登面板翻日志。</p>
<p>办公室电脑（任意终端，普通用户）：</p>
<pre><code>curl -I --connect-timeout 5 https://你的域名</code></pre>
<p>目标服务器（root 或 sudo 身份，阿里云 ECS / AWS EC2 都适用）：</p>
<pre><code>ss -lntp | egrep ':80|:443'</code></pre>
<ul>
<li>外网 <strong>超时</strong>、本机 80/443 有进程在听：优先查云安全组，再查 firewalld / ufw / iptables。包卡在进来的路上。</li>
<li>本机 <code>curl -I 127.0.0.1</code> 返回 200，但 PHP 上传、Nginx 反代到 9000 端口报 403 或 502：转去查 SELinux，别动防火墙。</li>
<li>两边都通、只有海外慢：那不是拦截，是线路，另开一节讲。</li>
</ul>
<p>云上这层最容易漏。阿里云 ECS 我见得最多的是安全组只放了 80，<strong>443 没放</strong>，迁移完 HTTPS 全站对德国客户不可见。AWS EC2 要多看一层：Security Group 之外还有 Network ACL。NACL 无状态，入站放了 443、出站没放 <strong>1024-65535</strong> 临时端口，回程包直接被丢，表现就是连接建立一半卡住，欧美比东南亚更明显。这个不是猜的，看 VPC Flow Logs 里的 REJECT 就能定。</p>
<table>
<tr>
<th>层</th>
<th>在哪看</th>
<th>典型漏项</th>
</tr>
<tr>
<td>云平台</td>
<td>ECS 安全组 / EC2 SG + NACL</td>
<td>443 未放行、NACL 回程临时端口</td>
</tr>
<tr>
<td>系统</td>
<td>firewalld、ufw、iptables</td>
<td>迁移后规则没导过来，重启失效</td>
</tr>
<tr>
<td>SELinux</td>
<td><code>/var/log/audit/audit.log</code></td>
<td>httpd 不能连 9000、上传目录上下文不对</td>
</tr>
</table>
<p>宝塔面板 8.x 的「安全」页面放行端口，只改了本机 firewalld，<strong>不等于云控制台安全组已放行</strong>。这个坑我踩过：一台 WordPress 站迁到新 ECS，面板里 80、443、888 全勾了，德国客户连续两小时打不开，最后在云控制台补一条 443 入站才恢复。所以我现在迁移完，一定两处都核一遍，不替客户省那两分钟。</p>
<p>先定位再动手，临时验证也别整层关防护。确认是哪层之后，各层有各层的查法和命令，后面逐层给。</p>
<h2 id="fuwuqi120-h2-2">它是什么：拦截发生在网站之前或之后</h2>
<p><strong>拦截分两段：端口前面挡连接，Web 之后挡读写。</strong></p>
<p>云安全组和系统防火墙，判的是「这个包能不能进到 80 / 443」。它们在 Nginx、Apache 之前生效。WordPress 一行 PHP 都没跑到，欧美客户浏览器上就已经是 <code>ERR_CONNECTION_TIMED OUT</code>，本地 <code>curl</code> 多半回 <code>curl: (7) Failed to connect</code>。我处理外贸站迁移时见过太多次：ECS 上 nginx 跑得好好的，安全组只放了 22，海外测速全红，后台却显示「服务正常」。阿里云 ECS、<a href="https://www.fuwuqi120.com/tag/aws-ec2/">AWS EC2</a> 都是这一层先拦，跟备案、PayPal 回调没关系，回调请求根本没进门。</p>
<table>
<tr>
<th>层</th>
<th>管什么</th>
<th>典型现场</th>
</tr>
<tr>
<td>云安全组 / firewalld / ufw / iptables</td>
<td>能不能连到端口</td>
<td><code>ERR_CONNECTION_TIMED OUT</code>、<code>curl: (7) Failed to connect</code></td>
</tr>
<tr>
<td>Nginx / Apache + PHP-FPM</td>
<td>请求已进门，转给谁</td>
<td>502、504、 upstream 报错</td>
</tr>
<tr>
<td>SELinux / AppArmor</td>
<td>进程能读哪些文件、能不能外连</td>
<td><code>avc: denied { write }</code>、<code>PHP file_put_contents(): Permission denied</code></td>
</tr>
</table>
<p>SELinux 在 Web 服务之后。端口通了、页面也开了，它照样能让上传、缓存、支付日志全挂。CentOS 7、AlmaLinux 8/9、Rocky Linux 8/9 默认可能是 <code>Enforcing</code>；Ubuntu 22.04 / 24.04 一般用 AppArmor，别把 <code>setenforce</code> 那套命令照搬过去，我踩过这个坑，执行完直接报 command not found。启动阶段被挡会看到 <code>nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)</code>，这种不是端口占用，是上下文不对。</p>
<p>迁移最容易出问题的位置，是把站点从 <code>/var/www</code> 挪到 <code>/home/wwwroot</code> 或挂了数据盘。<code>chown</code> 改了属主，SELinux 上下文没跟着变。首页能开，图片传不上去，WooCommerce 的支付回调日志写不进 <code>wp-content</code>，客户那边显示付款成功、后台订单还挂着待付款。东南亚线路慢的时候更隐蔽，超时和拒绝日志混在一起，看着像网络问题。</p>
<p>30 秒判断，在<strong>出问题的那台 ECS / EC2 上用 root</strong> 跑：</p>
<pre><code># 哪台：故障服务器；身份：root
curl -I -m 5 127.0.0.1
ss -lntp | grep -E ':80|:443'
getenforce 2&gt;/dev/null || echo "no SELinux (check AppArmor)"
aa-status 2&gt;/dev/null | head -5
grep -i 'avc:.*denied' /var/log/audit/audit.log | tail -10
</code></pre>
<ul>
<li>本机 <code>curl</code> 通、海外不通：先查安全组入站 80/443，再看 <code>firewall-cmd --list-all</code> 或 <code>ufw status</code>。</li>
<li>本机就不通、<code>ss</code> 没监听：看 nginx 启动日志里的 <code>13: Permission denied</code>。</li>
<li>页面开、上传失败、audit.log 有 <code>denied { write }</code>：是 SELinux 上下文，不是目录权限，别急着 <code>chmod 777</code>。</li>
</ul>
<p>我一般先留着 <code>Enforcing</code>，只补上下文，不整机关防护。外贸站收单期间动 <code>setenforce 0</code>，重启后又回 Enforcing，半夜照样报障。代维这类排查按次 300–800 元，含迁移后上下文核对的月度托管多在 800–2000 元/台，具体看盘是不是外挂、有没有多台负载，不确定就先别报死数。</p>
<h2 id="fuwuqi120-h2-3">能解决什么问题：访问、回调和后台异常</h2>
<p>这类拦截更多表现为局部异常，不是整站打不开。</p>
<p>我接外贸站的单子，十次里有六次不是 Nginx 挂了。美国客户产品页秒开，一点 Checkout 就转 8 到 12 秒然后 504，最常见的组合是安全组入站 443 放了、系统防火墙出站 443 没放，服务器根本连不上支付网关。东南亚线路本身抖，晚高峰丢包 3% 到 8%，这种超时很容易被运营先归到 CDN 头上，我一般会先在机器上直接 curl 一次网关域名，比看 CDN 报表快。</p>
<p>30 秒判断，在<strong>出问题的 ECS / EC2</strong> 上用 <code>root</code> 或 sudo 身份执行：</p>
<pre><code># 出站 443 通不通，5 秒不返回就是被拦或线路问题
curl -I --connect-timeout 5 https://api.stripe.com 2&gt;&amp;1 | head -5
# 看 firewalld 有没有记下拒绝
grep -i 'REJECT|DROP' /var/log/messages | tail -20
# SELinux 侧，WooCommerce 回调不回写重点看这个
getsebool httpd_can_network_connect
getsebool -a | grep -i httpd_can</code></pre>
<p>WordPress 后台更新插件一直转圈、WooCommerce 订单付了钱状态还是 pending，别急着改 PHP 超时。<code>httpd_can_network_connect</code> 默认是 <code>off</code>，CentOS 7 / AlmaLinux 8 上装完宝塔也常是这个值，<a href="https://www.fuwuqi120.com/tag/php-fpm/">PHP-FPM</a> 发起的外连会被 SELinux 静默挡掉，日志里不一定有 502。firewalld 同理，只 <code>--add-port=443/tcp</code> 管的是入站，出站得看 <code>--direct</code> 规则或者云厂商那层。</p>
<table>
<tr>
<th>现象</th>
<th>先查哪层</th>
<th>典型参数 / 位置</th>
</tr>
<tr>
<td>产品页正常、结账 504</td>
<td>出站 443 + 支付网关 IP 段</td>
<td><code>curl --connect-timeout 5</code>、云安全组出方向</td>
</tr>
<tr>
<td>插件更新转圈、订单不回写</td>
<td>SELinux 布尔值</td>
<td><code>httpd_can_network_connect=off</code></td>
</tr>
<tr>
<td>欧美通、东南亚慢且偶发超时</td>
<td>线路 + WAF 回调白名单</td>
<td>新加坡节点丢包 3%-8%，别先动 CDN</td>
</tr>
<tr>
<td>大陆 ECS 域名整个打不开</td>
<td>备案，不是防火墙</td>
<td>未备案 80/443 被云侧拦，firewalld 看不出</td>
</tr>
</table>
<p>备案这块要拆开看。大陆 ECS 绑域名必须备案，没备案被拦是云接入层干的，你在机器上翻 firewalld 日志翻一晚上也白翻。海外 ECS、AWS 新加坡 <code>ap-southeast-1</code>、法兰克福 <code>eu-central-1</code> 不涉及备案，但支付回调的 IP 段和 WAF 规则得单独核，我见过 Stripe 回调被自建 WAF 当爬虫挡了两天，订单全卡在待付款。</p>
<p>确认是布尔值的问题，在<strong>同一台机器</strong>用 <code>root</code> 执行，别顺手 <code>setenforce 0</code>：</p>
<pre><code>setsebool -P httpd_can_network_connect on
# firewalld 只补出站放行时，先记当前规则再改
firewall-cmd --list-all &gt; /root/fw-before-$(date +%F).txt
firewall-cmd --get-active-zones
# 验证，别只看命令没报错
curl -I --connect-timeout 5 https://api.stripe.com | head -1</code></pre>
<ul>
<li>单次排查放行加基础加固，300-800 元，一般 1 到 2 小时收工。</li>
<li>包年巡检含日志、备份、补丁，3000-9000 元/台，多站点按台数叠。</li>
<li>被黑后清理和迁移另算，看站点数量和数据库大小，<strong>库没量过我不报死价</strong>。</li>
</ul>
<p>改完别关页面，拿一台美国代理和一台新加坡代理各跑一次完整下单，回调日志对上订单号才算完。这个坑我踩过，只在本机 curl 通了就交单，第二天客户照样丢单。</p>
<h2 id="fuwuqi120-h2-4">具体怎么做一：30 秒判断加端口放行</h2>
<p>先在外网测连通，再登服务器看监听和规则，最后才放行端口。</p>
<p>别在服务器本机 curl 自己的域名。这个坑我早年踩过：本机回环通、宝塔也显示正常，结果德国客户连 443 都握不上手，查了 40 分钟才发现是 ECS 安全组只放了 22。找一台办公网机器、或者手机开热点都行，身份不限，30 秒出结果：</p>
<pre><code>curl -I --connect-timeout 5 https://你的域名
nc -vz 服务器公网IP 443
mtr -rwzc 50 服务器公网IP</code></pre>
<p><code>curl</code> 卡在连接阶段、<code>nc</code> 直接 refused 或 timeout，但服务器上端口确实在听，九成是云侧安全组或系统防火墙挡了。<code>mtr</code> 跑 50 个包主要看是全程丢包还是最后一跳丢；欧美线路常在跨洋段抖，东南亚线路更常见的是到本地运营商就断，这两种别当成防火墙问题硬查。支付回调失败尤其要看这个，PayPal / Stripe 的回源 IP 在海外，国内测试机通不代表它们能进来。</p>
<p>登到目标 ECS / EC2，用 root 或带 sudo 的账号，先看再改。四行下去，监听、firewalld、遗留 iptables 规则一次摊开：</p>
<pre><code>systemctl status firewalld --no-pager
ss -lntp | egrep ':80|:443|:8888'
firewall-cmd --list-all
iptables -S | head -40</code></pre>
<p><code>ss</code> 里没有 <code>:443</code>，先别动防火墙，那是 Nginx 没起来或者没绑公网网卡，属于另一层的事。有监听、<code>firewall-cmd --list-all</code> 的 services 里却没 http/https，就按下面放。改完立刻 reload，别等重启，重启容易把没写进 permanent 的规则一起丢掉：</p>
<pre><code>firewall-cmd --permanent --add-service=http &amp;&amp; firewall-cmd --permanent --add-service=https &amp;&amp; firewall-cmd --reload &amp;&amp; firewall-cmd --list-all</code></pre>
<ul>
<li><strong>宝塔 8888 只放办公 IP</strong>，例如 <code>firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="你的办公公网IP/32" port port="8888" protocol="tcp" accept'</code>。对 <code>0.0.0.0/0</code> 开面板，我接过的被黑单子里至少一半是从这里进来的。</li>
<li>Ubuntu 22.04 用 ufw 的机器换这套，别混用 firewalld 命令：<code>ufw status verbose</code>，然后 <code>ufw allow 80/tcp &amp;&amp; ufw allow 443/tcp &amp;&amp; ufw reload</code>。</li>
<li>云控制台同步核对入站 80/443、出站 443。出站不放 443，WordPress 拉更新、Stripe 校验、汇率接口都会静默超时，前台看着像&#8221;网站慢&#8221;。</li>
<li>AWS EC2 额外看 NACL 的入站 <strong>1024-65535</strong> 回程规则。安全组是有状态的，NACL 不是，只放 443 进不放临时端口出，欧美客户会表现为&#8221;偶尔能开、刷新又白屏&#8221;。</li>
</ul>
<table>
<tr>
<th>现象</th>
<th>大概率位置</th>
<th>下一步</th>
</tr>
<tr>
<td>nc 443 不通，ss 有监听</td>
<td>云安全组 / firewalld</td>
<td>放行后回外网机复跑 nc</td>
</tr>
<tr>
<td>国内通、欧美 timeout，mtr 末跳丢</td>
<td>安全组区域或 NACL</td>
<td>查入站来源与 1024-65535</td>
</tr>
<tr>
<td>ss 无 443</td>
<td>Web 服务层</td>
<td>先查 Nginx，不动防火墙</td>
</tr>
</table>
<p>改完别在服务器上验。回到最开始那台外网机，把 <code>nc -vz 服务器公网IP 443</code> 和 <code>curl -I --connect-timeout 5 https://你的域名</code> 再跑一遍，能拿到 <code>HTTP/2 200</code> 或 <code>301</code> 才算这一层过了。整套操作正常 3 到 5 分钟，代维按次收一般在 200-600 元区间，包月里通常不单算；要是复测仍不通，留着 <code>iptables -S</code> 的输出再往下查 SELinux，别顺手 <code>systemctl stop firewalld</code> 图省事。</p>
<h2 id="fuwuqi120-h2-5">具体怎么做二：SELinux 用日志修，不直接关</h2>
<p><strong>SELinux 按日志修策略，别直接关掉。</strong>关掉最省事，也最容易把问题盖住。我接过的外贸站里，WordPress 传图失败、支付回调 502、Nginx 换 8081 后起不来，不少都出在上下文或布尔值上，不是端口没开。</p>
<p>先拿 <code>avc: denied</code> 原文。没有原文就改策略，基本靠猜。CentOS 7 和 AlmaLinux 9 都能用下面这组，在<strong>目标机、root 身份</strong>执行：</p>
<pre><code>getenforce
sestatus
ls -ldZ /var/www/html /home/wwwroot
journalctl -t setroubleshoot --since '30 min ago' --no-pager | tail -60</code></pre>
<p>宝塔站常见路径是 <code>/home/wwwroot</code>，手工部署的 WordPress 多在 <code>/var/www/html</code>。看 <code>ls -ldZ</code> 里的类型对不对，再看日志里被拒的是文件写入、端口绑定，还是 PHP-FPM 往外连。AlmaLinux 9 上如果 <code>setroubleshoot</code> 没装，journalctl 可能空，我不确定每台机器都带，这时直接查 <code>/var/log/audit/audit.log</code> 里的 avc 行。</p>
<p>临时验证只给一次机会，<strong>目标机 root</strong>：</p>
<pre><code>setenforce 0
curl -I http://127.0.0.1
setenforce 1</code></pre>
<p>复测完立刻回 1。我一般不允许外贸站长期写 <code>SELINUX=disabled</code>。欧美客户下单、支付网关回调都在跑，一旦被挂马，少了这层限制，清理时间和订单损失会大很多。临时关只是确认「是不是它挡的」，不是修法。</p>
<table>
<tr>
<th>日志里的现象</th>
<th>对应处理</th>
<th>外贸站场景</th>
</tr>
<tr>
<td>wp-content 写入被拒</td>
<td>改目录上下文</td>
<td>后台传产品图、插件升级失败</td>
</tr>
<tr>
<td>Nginx 绑 8081 被拒</td>
<td>加 http_port_t</td>
<td>迁移后临时端口、海外节点反代</td>
</tr>
<tr>
<td>PHP-FPM 出站被拒</td>
<td>开 httpd_can_network_connect</td>
<td>支付 API、ERP 回调超时</td>
</tr>
</table>
<p>按实际路径修，别照抄别人的目录。<strong>目标机 root</strong>，WordPress 上传目录示例：</p>
<pre><code>semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/wp-content(/.*)?' &amp;&amp; restorecon -Rv /var/www/html/wp-content
setsebool -P httpd_can_network_connect 1</code></pre>
<p>第二条给 Nginx 反代 PHP-FPM、支付 API 出站用。东南亚线路偶尔超时，先确认是网络还是这条布尔值，别混着查。非标准端口 8081 也别靠关 SELinux，<strong>目标机 root</strong>：</p>
<pre><code>semanage port -a -t http_port_t -p tcp 8081
systemctl restart nginx &amp;&amp; curl -I http://127.0.0.1:8081</code></pre>
<p>如果报「已存在」，换成 <code>-m</code>，别重复加：</p>
<pre><code>semanage port -m -t http_port_t -p tcp 8081
systemctl restart nginx &amp;&amp; curl -I http://127.0.0.1:8081</code></pre>
<ul>
<li><code>semanage</code> 找不到：CentOS 7 装 <code>policycoreutils-python</code>，AlmaLinux 9 装 <code>policycoreutils-python-utils</code>，版本差异我踩过。</li>
<li>改完只在本机 curl 不够。再从欧美或东南亚节点复测一次前台和回调地址，跨境链路和本机回环不是一回事。</li>
<li>没抓到 avc 原文就先别动 <code>-P</code> 布尔值。策略一开就是永久生效，回头不好定位是哪次改动引入的。</li>
</ul>
<h2 id="fuwuqi120-h2-6">注意什么：改完要复测，别把门全打开</h2>
<p>改完必须复测，放行按业务收窄，别图省事全开。</p>
<p>我接过的外贸站故障里，有一半是&#8221;修完没验&#8221;留下的尾巴。国内 ping 通了就结案，第二天欧美客户照样打不开，或者 PayPal / Stripe 回调静悄悄丢掉，订单卡在待付款。防护不是障碍，全开才是。去年一台 AWS EC2 被人把 SSH 写成 <code>0.0.0.0/0</code>，我看了下 <code>/var/log/secure</code>，3 小时 47 分就有 1200 多条失败尝试，扫描来得比想象快。</p>
<table>
<tr>
<th>用途</th>
<th>端口</th>
<th>来源</th>
<th>说明</th>
</tr>
<tr>
<td>前台访客</td>
<td>80 / 443</td>
<td>0.0.0.0/0</td>
<td>欧美、东南亚都要能进，这个必须公网</td>
</tr>
<tr>
<td>SSH</td>
<td>22</td>
<td>办公固定 IP / 32</td>
<td>AWS 安全组别写全开，改密钥也挡不住扫</td>
</tr>
<tr>
<td><a href="https://www.fuwuqi120.com/%e5%ae%9d%e5%a1%94%e9%9d%a2%e6%9d%bf%e8%b7%91%e5%a4%96%e8%b4%b8%e7%ab%99%ef%bc%9a%e8%83%bd%e7%94%a8%e5%88%b0%e5%93%aa%e4%b8%80%e6%ad%a5/">宝塔面板</a></td>
<td>8888</td>
<td>办公固定 IP / 32</td>
<td>顺手改掉默认端口，别和 888 混</td>
</tr>
<tr>
<td>本机回环 / 内网</td>
<td>3306、6379</td>
<td>127.0.0.1 或 VPC 内网段</td>
<td>不对外，WooCommerce 走本机就够</td>
</tr>
</table>
<p>复测至少挑两个位置，欧美一个、东南亚一个。只在国内跑一遍不算数，跨境链路和国内完全两回事。我一般会从新加坡和法兰克福各连 3 次，看 <code>time_connect</code> 有没有忽高忽低。</p>
<p><strong>在任意一台海外跳板机或本地终端，普通用户执行：</strong></p>
<pre><code>for i in 1 2 3; do curl -w '%{http_code} %{time_connect} %{time_total}n' -o /dev/null -s https://你的域名; done</code></pre>
<p>三次都是 200、连接时间稳定在 0.2s 上下才算过。东南亚偶尔 1.5s 以上，先别动防火墙，查线路更实在。</p>
<p>支付回调不能只看页面。做一笔 0.5–1 USD 的小额订单，或者用网关后台的测试请求打一次，然后回源站看日志。</p>
<p><strong>在 Web 服务器，root 或 sudo 身份执行：</strong></p>
<pre><code>tail -100 /var/log/nginx/access.log
tail -100 /var/log/nginx/error.log</code></pre>
<p>access.log 里压根没有那条 POST，别去翻 WooCommerce 插件设置，问题还在安全组或系统防火墙那一层。有请求但 403 / 502，再回头看 SELinux 上下文和 php-fpm。这个顺序我踩过反的坑，白折腾两小时。</p>
<ul>
<li>宝塔 7.x / 8.x 改完面板端口，云安全组和 <code>firewall-cmd</code> 两边都要对一遍，只改一边最常见。</li>
<li>阿里云 ECS 有</li>
</ul>
<h2 id="fuwuqi120-faq">常见问题</h2>
<h3>外贸网站国外客户打不开，国内能打开，是防火墙或 SELinux 阻止吗</h3>
<p>先查云安全组入站和地域线路。SELinux 不会只挡国外 IP，国内国外都异常才更像它。</p>
<h3>阿里云 ECS 安全组放了 443，WordPress 还是连接超时怎么办</h3>
<p>再查系统 firewalld/ufw 和实例出站规则。用 `nc -vz 公网IP 443` 从外网复测。</p>
<h3>AWS EC2 Security Group 已开 80/443，为什么欧美访问还是超时</h3>
<p>检查 NACL 是否放行 1024-65535 回程，以及实例绑定的是否为当前安全组。</p>
<h3>宝塔面板放行端口后网站后台 502，SELinux 要不要永久关闭</h3>
<p>不要。查 `avc: denied`，修 wp-content 上下文或 `httpd_can_network_connect`，保持 Enforcing。</p>
<h3>WooCommerce 支付回调失败，服务器日志没有请求记录怎么定位</h3>
<p>多半在到达 PHP 前被拦。核对云安全组、WAF、出站 443，再让网关重发测试回调。</p>
<div class="fuwuqi120-cta">
<p>服务器又出问题了？外贸站的宕机、被黑、迁移和访问慢，我们按次或按月代维，先免费看机器再报价。</p>
<p><a class="fuwuqi120-cta-btn" href="/service/">看看代维服务</a></p>
</div>
<div class="fuwuqi120-grid">
<p class="fuwuqi120-grid-title"><strong>0</strong></p>
<div class="fuwuqi120-grid-inner"><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%93%e4%b8%9a%e5%ae%89%e5%85%a8%e4%bb%a3%e7%bb%b4-%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%bb%a3%e7%bb%b4-%e9%98%bf%e9%87%8c%e4%ba%91%e4%bb%a3%e7%bb%b4-%e4%ba%91-3/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e4ba91e69c8de58aa1e599a8e4b893e4b89ae5ae89e585a8e4bba3e7bbb4-e69c8de58aa1e599a8e4bba3e7bbb4-e998bfe9878ce4ba91e4bba3e7bbb4-e4ba91-siyapL-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">上云咨询 上云迁移</span><span class="fuwuqi120-card-title">云服务器专业安全代维 服务器代维 阿里云代维 云主机代维 运维外包服务</span><span class="fuwuqi120-card-date">2020-02-13</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e4%bc%81%e4%b8%9a%e4%b8%8a%e4%ba%91%e8%bf%81%e7%a7%bb%e6%96%b9%e6%a1%88%e5%ae%9e%e6%96%bd%e6%9c%8d%e5%8a%a1/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e4bc81e4b89ae4b88ae4ba91e8bf81e7a7bbe696b9e6a188e5ae9ee696bde69c8de58aa1-EOsg19-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">企业上云迁移方案实施服务</span><span class="fuwuqi120-card-title">企业上云迁移方案实施服务</span><span class="fuwuqi120-card-date">2019-03-05</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e5%bb%ba%e7%ab%8b-vpc-%e5%b9%b6%e5%9f%ba%e4%ba%8e%e5%8f%82%e6%95%b0%e5%8a%a8%e6%80%81%e5%88%9b%e5%bb%ba%e5%ad%90%e7%bd%91%e7%9a%84-cloudformation-%e6%a8%a1%e6%9d%bf/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e5bbbae7ab8b-vpc-e5b9b6e59fbae4ba8ee58f82e695b0e58aa8e68081e5889be5bbbae5ad90e7bd91e79a84-cloudformation-e6a8a1e69dbf-Jvk8QS-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">aliyun服务器代维</span><span class="fuwuqi120-card-title">建立 VPC 并基于参数动态创建子网的 CloudFormation 模板</span><span class="fuwuqi120-card-date">2018-11-21</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e4%bd%bf%e7%94%a8-aws-lambda-%e6%94%af%e6%8c%81%e7%9a%84%e5%ae%8f%e6%89%a9%e5%b1%95-aws-cloudformation/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e4bdbfe794a8-aws-lambda-e694afe68c81e79a84e5ae8fe689a9e5b195-aws-cloudformation-bHjf25-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">aliyun服务器代维</span><span class="fuwuqi120-card-title">使用 AWS Lambda 支持的宏扩展 AWS CloudFormation</span><span class="fuwuqi120-card-date">2018-11-21</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e5%b0%86%e4%ba%9a%e9%a9%ac%e9%80%8a-aws-s3-%e5%ad%98%e5%82%a8%e6%a1%b6%e7%9a%84%e8%ae%bf%e9%97%ae%e6%9d%83%e9%99%90%e5%88%b0%e4%b8%80%e4%b8%aa%e7%89%b9%e5%ae%9a-iam-%e8%a7%92%e8%89%b2/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e5b086e4ba9ae9a9ace9808a-aws-s3-e5ad98e582a8e6a1b6e79a84e8aebfe997aee69d83e99990e588b0e4b880e4b8aae789b9e5ae9a-iam-e8a792e889b2-GrWvNu-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">linux代维</span><span class="fuwuqi120-card-title">将亚马逊 AWS S3 存储桶的访问权限到一个特定 IAM 角色</span><span class="fuwuqi120-card-date">2018-11-21</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e5%85%a8%e7%ab%99%e5%8a%a0%e9%80%9f%ef%bc%8camazon-cloudfront-%e9%85%8d%e7%bd%ae/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e585a8e7ab99e58aa0e9809fefbc8camazon-cloudfront-e9858de7bdae-b4Tmoc-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">AWS</span><span class="fuwuqi120-card-title">全站加速，Amazon CloudFront 配置</span><span class="fuwuqi120-card-date">2018-08-17</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e5%af%b9%e9%9b%86%e7%be%a4%e4%bb%bb%e5%8a%a1%e6%9c%80%e5%b0%8f%e5%bd%b1%e5%93%8d%e7%9a%84-ecs-%e5%ae%b9%e5%99%a8%e5%ae%9e%e4%be%8b%e8%87%aa%e5%8a%a8%e5%8c%96/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e5a682e4bd95e5ae9ee78eb0e5afb9e99b86e7bea4e4bbbbe58aa1e69c80e5b08fe5bdb1e5938de79a84-ecs-e5aeb9e599a8e5ae9ee4be8be887aae58aa8e58c96-phm6Fc-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">Amazon AWS</span><span class="fuwuqi120-card-title">如何实现对集群任务最小影响的 ECS 容器实例自动化终止方案</span><span class="fuwuqi120-card-date">2018-08-17</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/%e4%bd%bf%e7%94%a8-amazon-polly-%e9%92%88%e5%af%b9-aws-%e8%b4%a6%e6%88%b7%e5%ae%89%e5%85%a8%e4%ba%8b%e4%bb%b6%e8%bf%9b%e8%a1%8c%e7%94%b5%e8%af%9d%e5%91%bc%e5%8f%ab%e6%8a%a5%e8%ad%a6/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/e4bdbfe794a8-amazon-polly-e99288e5afb9-aws-e8b4a6e688b7e5ae89e585a8e4ba8be4bbb6e8bf9be8a18ce794b5e8af9de591bce58fabe68aa5e8ada6-t3Ud5J-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">服务器安全设置</span><span class="fuwuqi120-card-title">使用 Amazon Polly 针对 AWS 账户安全事件进行电话呼叫报警</span><span class="fuwuqi120-card-date">2018-03-23</span></span></a><a class="fuwuqi120-card" href="https://www.fuwuqi120.com/amazon-guardduty-%e6%8c%81%e7%bb%ad%e5%ae%89%e5%85%a8%e7%9b%91%e6%8e%a7%e5%92%8c%e5%a8%81%e8%83%81%e6%a3%80%e6%b5%8b/"><span class="fuwuqi120-card-thumb" style="background-image:url(https://www.fuwuqi120.com/wp-content/uploads/2026/11/amazon-guardduty-e68c81e7bbade5ae89e585a8e79b91e68ea7e5928ce5a881e88381e6a380e6b58b-4ds81B-768x430.webp)" aria-hidden="true"></span><span class="fuwuqi120-card-body"><span class="fuwuqi120-card-cat">Amazon AWS</span><span class="fuwuqi120-card-title">Amazon GuardDuty – 持续安全监控和威胁检测</span><span class="fuwuqi120-card-date">2018-03-23</span></span></a></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.fuwuqi120.com/%e9%98%b2%e7%81%ab%e5%a2%99%e6%88%96-selinux-%e9%98%bb%e6%ad%a2%e6%80%8e%e4%b9%88%e6%9f%a5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
