服务器之迁徙
私人服务器从腾讯云迁到便宜的华为ECS,重装系统。
装 node
,
装 mongodb
,
装 nginx
检测nginx 正常
nginx -t 正常
启动nginx 服务,一切正常
service nginx start
查看进程 正常
ps -ef |grep nginx
浏览器打开
http://ip
无法访问
排查
服务器 ping 外网
root@ruff-server-01:~# ping www.baidu.com
PING www.a.shifen.com (180.97.33.107) 56(84) bytes of data.
64 bytes from 180.97.33.107: icmp_seq=1 ttl=47 time=30.2 ms
64 bytes from 180.97.33.107: icmp_seq=2 ttl=47 time=29.8 ms
64 bytes from 180.97.33.107: icmp_seq=3 ttl=47 time=29.7 ms
64 bytes from 180.97.33.107: icmp_seq=4 ttl=47 time=29.7 ms
64 bytes from 180.97.33.107: icmp_seq=5 ttl=47 time=29.7 ms
64 bytes from 180.97.33.107: icmp_seq=6 ttl=47 time=29.8 ms
64 bytes from 180.97.33.107: icmp_seq=7 ttl=47 time=29.7 ms
64 bytes from 180.97.33.107: icmp_seq=8 ttl=47 time=29.7 ms
正常
ping 服务器
PING xx.xx.xx.xx(xx.xx.xx.xx): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
curl
请求本地
root@ruff-server-01:~# curl 127.0.0.1
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
问题所在
打开华为云服务器的控制台,打开服务器的更改安全组> 修改安全组 > 配置规则。
将你要用的端口添加到规则中,出方向 入方向都需要添加。
打勾并添加。
重启服务器
之前配置的服务已能正常使用。