Common VPS Issues and Solutions
This guide covers frequently encountered problems on {{COMPANY_NAME}} VPS servers and their solutions. Use this as a quick reference when troubleshooting.
1. High CPU Usage
Symptoms
- Slow website loading
- SSH commands take long to execute
- Load average above CPU core count
Diagnosis
bash
# Check load average
uptime
# Find CPU-heavy processes
top -bn1 -o %CPU | head -15
# Check for cryptocurrency miners or malware
ps aux | grep -E "xmrig|minerd|cryptonight"Solutions
- Kill runaway processes:
bash
kill -9 PID- Optimize your application:
- Enable caching (Redis, Memcached)
- Optimize database queries
- Use PHP OPcache for PHP applications
- Check for malware:
bash
sudo apt install clamav -y
sudo freshclam
sudo clamscan -r /var/www/ --infected- Upgrade your VPS if legitimate workload exceeds capacity
2. High Memory Usage / OOM Kills
Symptoms
- Services crash and restart unexpectedly
- "Cannot allocate memory" errors
- High swap usage
Diagnosis
bash
# Check memory
free -h
# Check OOM killer log
dmesg | grep -i oom | tail -5
# Memory usage by process
ps aux --sort=-%mem | head -10Solutions
- Add or increase swap space:
bash
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab- Tune MySQL/MariaDB memory:
Edit /etc/mysql/mysql.conf.d/mysqld.cnf:
ini
innodb_buffer_pool_size = 256M # reduce for low-memory VPS
max_connections = 50
key_buffer_size = 16M- Tune PHP-FPM:
Edit your PHP-FPM pool config:
ini
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 10s- Restart services to free memory:
bash
sudo systemctl restart mysql
sudo systemctl restart php*-fpm
sudo systemctl restart nginx3. Disk Space Full
Symptoms
- "No space left on device" errors
- Services fail to start
- Cannot create or save files
Diagnosis
bash
# Check disk usage
df -h
# Find large directories
du -h / --max-depth=1 | sort -hr | head -10
# Find large files
find / -type f -size +100M -exec ls -lh {} ; 2>/dev/nullSolutions
- Clean package cache:
bash
sudo apt clean
sudo apt autoremove -y- Rotate and compress logs:
bash
sudo journalctl --vacuum-size=100M
sudo find /var/log -name "*.gz" -mtime +30 -delete- Remove old kernels:
bash
sudo apt autoremove --purge- Clear temporary files:
bash
sudo rm -rf /tmp/*
sudo rm -rf /var/tmp/*- Check for large database binary logs:
bash
sudo ls -lh /var/lib/mysql/*-bin.*
# Purge old binary logs
mysql -e "PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY);"4. Website Returns 502 Bad Gateway
Symptoms
- Browser shows "502 Bad Gateway" error
- Nginx error log shows upstream connection errors
Diagnosis
bash
# Check PHP-FPM status
sudo systemctl status php*-fpm
# Check Nginx error log
sudo tail -20 /var/log/nginx/error.logSolutions
- Restart PHP-FPM:
bash
sudo systemctl restart php8.2-fpm # adjust version number- Check socket/port configuration matches between Nginx and PHP-FPM
- Increase PHP-FPM children:
ini
pm.max_children = 20- Check PHP-FPM logs:
bash
sudo tail -30 /var/log/php8.2-fpm.log5. MySQL/MariaDB Won't Start
Symptoms
- "Can't connect to local MySQL server" error
- Service fails to start
Diagnosis
bash
sudo systemctl status mysql
sudo tail -50 /var/log/mysql/error.logSolutions
- Disk full preventing startup:
bash
df -h /var/lib/mysql
# Free space, then restart
sudo systemctl start mysql- Corrupted InnoDB logs:
bash
# Add to mysqld.cnf temporarily
innodb_force_recovery = 1
# Start MySQL, export data, remove the setting, reimport- Permission issues:
bash
sudo chown -R mysql:mysql /var/lib/mysql
sudo systemctl start mysql6. Cannot Send Emails
Symptoms
- Application email not delivered
- SMTP connection timeout
Diagnosis
bash
# Check if port 25 is open
telnet smtp.gmail.com 587
# Check mail logs
sudo tail -30 /var/log/mail.logSolutions
- Use an SMTP relay (recommended for VPS) instead of sending directly
- Check if your VPS provider blocks port 25 -- many providers do by default
- Configure SPF, DKIM, and DMARC records for your domain
- Use a transactional email service like Amazon SES, Mailgun, or SMTP2GO
7. Permission Denied Errors
Symptoms
- Web application shows permission errors
- Cannot read or write files
Solutions
bash
# Fix web directory ownership
sudo chown -R www-data:www-data /var/www/html
# Fix permissions
sudo find /var/www/html -type d -exec chmod 755 {} ;
sudo find /var/www/html -type f -exec chmod 644 {} ;
# For writable directories (uploads, cache)
sudo chmod 775 /var/www/html/storage
sudo chmod 775 /var/www/html/cache8. Time Zone Incorrect
Symptoms
- Logs show wrong timestamps
- Cron jobs run at unexpected times
Solution
bash
# Check current timezone
timedatectl
# Set timezone
sudo timedatectl set-timezone Asia/Kolkata
# Verify
date9. DNS Resolution Not Working
Symptoms
apt updatefails with "Temporary failure resolving..."- Cannot reach external services
Solutions
bash
# Check DNS config
cat /etc/resolv.conf
# Set reliable DNS servers
sudo nano /etc/resolv.confAdd:
nameserver 8.8.8.8
nameserver 1.1.1.1For permanent DNS on systems using systemd-resolved:
bash
sudo nano /etc/systemd/resolved.conf
# Set: DNS=8.8.8.8 1.1.1.1
sudo systemctl restart systemd-resolvedQuick Troubleshooting Checklist
- Is the VPS running? (check client area)
- Can you ping the VPS IP?
- Is the service (SSH, web, database) running?
- Is the disk full? (
df -h) - Is memory exhausted? (
free -h) - Are firewall rules correct? (
ufw status) - What do the logs say? (
/var/log/syslog, service-specific logs)
Related Articles
- VPS Not Responding: Troubleshooting Guide
- Monitoring VPS Resources (CPU, RAM, Disk)
- Setting Up a Firewall on Your VPS (UFW/iptables)
Need further help? Contact our support team at {{SUPPORT_EMAIL}} or open a ticket at {{SUPPORT_URL}}.