Home  >  Article  >  Operation and Maintenance  >  How to quickly troubleshoot the inability to open a website running on an ECS instance

How to quickly troubleshoot the inability to open a website running on an ECS instance

坏嘻嘻
坏嘻嘻Original
2018-09-28 15:43:502122browse

The content of this article is about how to quickly troubleshoot websites running on ECS instances that cannot be opened. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Quick troubleshooting The website running on the ECS instance cannot be opened

The website running on the Linux instance cannot be opened

Here The demonstration system is CentOS 6.8, please choose according to your actual situation.

1. Troubleshooting that port 80 is unavailable

Run the command netstat -an | grep 80 to check whether TCP port 80 is being monitored. If any of the following results are returned, it means that the Web service of TCP port 80 has been started:

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN # Whole network monitoring

tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN #Local monitoring

Among them, local monitoring will cause the external network to be unable to access the Web service. Only the local machine can access it. Please refer to Nginx, Tomcat, and IIS to change the port monitoring. The address method is changed to network-wide monitoring.

When the first step fails:

Check whether the instance security group allows port 80. See Adding Security Group Rules.

Check whether the instance iptables allows port 80.

Use telnet and traceroute to track the connection and disconnection of port 80. See the instructions for link testing when ping packets are lost or unavailable.

Check whether the cloud server bandwidth is full. Please refer to the analysis and solutions to the abnormal full bandwidth of cloud server ECS Linux server.

2. Troubleshooting that the Web service is unavailable

Use the management terminal to log in to the instance.

View the Web service log, such as the path /usr/local/var/log/nginx/ to store the CentOS 6.8 Nginx service log.

Use top to check the running status of the instance and check whether there are any abnormal processes.

Check the instance monitoring information on the console to see if the instance bandwidth is full. If it is full, you can try to upgrade the instance bandwidth.

Check whether the instance CPU/memory is exhausted. See troubleshooting ideas for high CPU usage in cloud server ECS Linux systems.

Check whether there are too many TCP links on port 80 of the instance.

Use netstat -anp |grep tcp |wc -l to count the number of TCP connections.

Compare the maximum value of net.ipv4.tcp_max_tw_buckets in the /etc/sysctl.conf configuration file to see if there is any excess. If it exceeds:

Execute vi /etc/sysctl.conf to edit the file and query the net.ipv4.tcp_max_tw_buckets parameter. If the connection usage is confirmed to be high, it is easy to exceed the limit.

Increase the parameter net.ipv4.tcp_max_tw_buckets to expand the limit.

Enter the command sysctl -p to make the configuration take effect.

Cannot open the website running on the Windows instance

The demonstration system here is Windows Server 2008, please choose based on your actual situation.

1. Troubleshooting that port 80 is unavailable

Execute the command netstat -ano | findstr :80 to check whether TCP 80 is being monitored. If any of the following results are returned, it means that the web service of TCP port 80 has been started.

TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 1172 # Indicates network-wide monitoring

TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 1172 # Indicates local monitoring

Among them, local monitoring will cause the external network to be unable to access the Web service. Only the local machine can access it. You can execute netsh http delete iplisten ipaddress= 127.0.0.1:80 to change it to full network monitoring.

When the first step fails:

Check whether the instance security group allows port 80. See Adding Security Group Rules.

Check whether the instance firewall allows port 80. See how Windows Firewall restricts port/IP/application access and how to configure exceptions.

Use telnet and tracert to track the connection and disconnection of port 80. See the instructions for link testing when ping packets are lost or unavailable.

Check whether the cloud server bandwidth is full. See Windows instance bandwidth and CPU full or high troubleshooting.

2. Troubleshooting that the Web service is unavailable

Use the management terminal to log in to the instance.

View the Web service log. For example, the Windows Server 2008 IIS service log location is: %SystemDrive%\inetpub\logs\LogFiles\W3SVC4.

Check the running status of the instance through Task Manager to see if there are any abnormal processes.

Check the instance monitoring information on the console to see if the instance bandwidth is full. If it is full, you can try to upgrade the instance bandwidth.

Check whether the instance CPU and memory are exhausted. See troubleshooting Windows instance bandwidth and CPU full or high usage or troubleshooting high CPU usage of cloud server Windows instances and tool recommendations.

Check whether there are too many TCP links on port 80 of the instance.

Execute the following command and count the number of TCP connections:

 netstat -n |find /i "time_wait" /c
 netstat -n |find /i "close_wait" /c
 netstat -n |find /i "established" /c

When the number of statistical TCP connections is too high, adjust TcpTimedWaitDelay to 30s, and its default value is 4 minutes (240s):

Open CMD and execute the command regedit.

Find HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > TCPIP > Parameters.

If there is no TcpTimedWaitDelay parameter:

Right-click Parameter > New DWORD (32-bit) value.

Enter TcpTimedWaitDelay and press Enter to confirm.

Right-click TcpTimedWaitDelay, click Modify, check Decimal, enter 30 as the numerical data, and click OK.

The above is the detailed content of How to quickly troubleshoot the inability to open a website running on an ECS instance. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn