VPS Tutorials
VPS Website Won't Load? Common Problem Diagnosis and Fixes
A complete troubleshooting guide for when a website on a VPS is unreachable: DNS checks, web server diagnosis, firewall configuration, SSL certificate fixes, resource monitoring, and more, with detailed commands and solutions.

A website on a VPS suddenly won't load — every site owner runs into this. Don't panic; this article helps you troubleshoot the problem systematically.
First figure out whether it's only you who can't access it, or everyone:
# 用 curl 测试网站是否能响应
curl -I https://你的域名.com
# 或者用在线工具
# https://downforeveryoneorjustme.com/
# https://www.isitdownrightnow.com/
If only you can't access it, it may be a local DNS cache or network issue. Flush your DNS:
# Windows
ipconfig /flushdns
# macOS
sudo dscacheutil -flushcache
# Linux
sudo systemd-resolve --flush-caches
Incorrect DNS configuration is one of the most common causes.
# 查看域名解析到哪个 IP
dig 你的域名.com +short
# 或者用 nslookup
nslookup 你的域名.com
The resolved IP should be your VPS's IP. If it isn't, log in to your domain registrar's backend and check the A record configuration.
DNS changes take time to propagate, usually as long as the TTL you set — generally anywhere from 5 minutes to 24 hours.
# ping 你的 VPS IP
ping 你的VPS_IP
# 检查 SSH 能否连接
ssh root@你的VPS_IP
If ping fails or SSH won't connect:
- Log in to your VPS provider's backend and check the machine status
- Try logging in via VNC/console
- Check whether the service is suspended for non-payment
After logging in to the VPS, first check whether the web server is running:
# 查看 Nginx 状态
systemctl status nginx
# 如果没运行,启动它
systemctl start nginx
# 检查配置是否正确
nginx -t
# 查看错误日志
tail -100 /var/log/nginx/error.log
# 查看 Apache 状态
systemctl status apache2 # Ubuntu/Debian
systemctl status httpd # CentOS/RHEL
# 启动服务
systemctl start apache2
# 检查配置
apachectl configtest
# 查看错误日志
tail -100 /var/log/apache2/error.log
Common reasons a web server fails to start:
- Syntax errors in configuration files
- Port already in use
- Incorrect SSL certificate path
# 查看 80 和 443 端口是否在监听
ss -tlnp | grep -E ':80|:443'
# 或者用 netstat
netstat -tlnp | grep -E ':80|:443'
Normal output should look something like:
LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=1234,fd=6))
LISTEN 0 511 0.0.0.0:443 0.0.0.0:* users:(("nginx",pid=1234,fd=7))
If no process is listening on these ports, the web server isn't running correctly.
The firewall may be blocking HTTP/HTTPS traffic.
# 查看规则
iptables -L -n
# 允许 80 和 443 端口
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
# 查看状态
firewall-cmd --state
# 开放端口
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
# 查看状态
ufw status
# 允许 Web 流量
ufw allow 'Nginx Full' # 或 'Apache Full'
Don't forget to check your cloud provider's security groups — AWS, Alibaba Cloud, Tencent Cloud and others all have security group settings, and you need to allow ports 80 and 443 in the backend.
If HTTP works but HTTPS won't load, it's usually a certificate problem.
# 检查证书是否过期
openssl s_client -connect 你的域名.com:443 2>/dev/null | openssl x509 -noout -dates
# 或者直接查看证书文件
openssl x509 -in /etc/nginx/ssl/cert.pem -noout -dates
If the certificate has expired, re-request it with certbot:
# 重新申请 Let's Encrypt 证书
certbot renew --force-renewal
# 重启 Web 服务器
systemctl reload nginx
Resource exhaustion can also make a website unreachable.
# 查看内存使用
free -h
# 查看 CPU 和进程
top -bn1 | head -20
# 查看磁盘空间
df -h
# 查看 inode 使用(小文件太多会用完 inode)
df -i
If memory is used up, the OOM Killer may have killed your web server or PHP processes.
# 检查是否有进程被 OOM 杀掉
dmesg | grep -i "out of memory"
# 或查看系统日志
grep -i "oom" /var/log/syslog
Temporary fix: restart the service. Long-term fix: upgrade memory or optimize the application.
# 找出大文件
du -sh /* | sort -hr | head -10
# 清理日志文件(谨慎操作)
truncate -s 0 /var/log/nginx/access.log
# 清理旧的软件包缓存
apt clean # Debian/Ubuntu
yum clean all # CentOS
For PHP sites like WordPress or Laravel, you also need to check PHP-FPM:
# 查看 PHP-FPM 状态
systemctl status php8.1-fpm # 版本号根据实际情况
# 查看 PHP-FPM 错误日志
tail -100 /var/log/php8.1-fpm.log
Common PHP problems:
- Memory limit too small: change
memory_limitin php.ini - Execution time timeout: adjust
max_execution_time - Not enough PHP-FPM processes: adjust
pm.max_children
Sometimes the server itself is fine and the application code is at fault.
# 查看应用日志
# WordPress
tail -100 /var/www/html/wp-content/debug.log
# Laravel
tail -100 /var/www/html/storage/logs/laravel.log
Enabling debug mode lets you see specific error messages, but remember to turn debug mode off in production, otherwise it will leak sensitive information.
| Error Code | Meaning | Where to Look |
|---|---|---|
| 502 Bad Gateway | Backend service not responding | Check PHP-FPM, application processes |
| 503 Service Unavailable | Service temporarily unavailable | Check load, resource usage |
| 504 Gateway Timeout | Backend processing timed out | Increase timeout, optimize code |
| 500 Internal Server Error | Internal server error | Check application logs, PHP errors |
| 403 Forbidden | Permission denied | Check file permissions, Nginx configuration |
| 404 Not Found | Page does not exist | Check URL, routing configuration |
Troubleshoot in this order and you'll basically cover 90% of cases:
- DNS → Is resolution correct?
- Network → Is the VPS online, can it be pinged?
- Ports → Are 80/443 listening?
- Firewall → Are web ports allowed?
- Web server → Is Nginx/Apache running?
- SSL → Is the certificate valid?
- Resources → Are CPU/memory/disk sufficient?
- Backend → Are PHP-FPM/application services normal?
- Application logs → Specific error messages
Rather than troubleshooting after problems arise, it's better to set up monitoring in advance:
- Set up Uptime monitoring (the free tiers of UptimeRobot and Better Uptime are enough)
- Configure server monitoring (Prometheus + Grafana)
- Set up log alerts
- Renew SSL certificates regularly (certbot auto-renews by default)
- Configure log rotation to prevent log files from filling up the disk
There are many reasons a website won't load, but the troubleshooting approach is fixed: from the network layer up to the application layer, check one layer at a time. Once you've mastered this method, you won't be scrambling the next time a problem comes up.
If you still can't find the cause after going through this process, you can post the error logs to a technical forum or the VPS provider's ticket system and let the professionals take a look.