Skip to content
Hosting Operations6 min read

Website Down? 7 Security Fixes That Work

Fix a website down by checking DNS, disk space, and firewall rules. Secure your server with these 7 hardening steps to prevent future outages.

Written by Abdul AbrorTechnical Hosting Support Engineer
A blue laptop displaying the WordPress logo on a speckled blue surface
On this page

TL;DR — Key takeaways

  • Check disk space and DNS resolution first; 80% of 'down' sites are caused by full partitions or stale DNS records.
  • Verify firewall rules before assuming an application crash; blocked ports mimic service failures.
  • Rotate SSH keys and disable root login to prevent unauthorized access that leads to resource exhaustion.
  • Use fail2ban or equivalent intrusion prevention to stop brute-force attacks from saturating CPU and memory.
  • Always backup configuration files before applying security hardening steps to enable quick rollback.

When a website goes down, the first instinct is to restart services. But in support tickets I handled, the usual culprit was a full disk or a misconfigured firewall, not a code bug.

This guide walks through the practical steps to diagnose and fix a down site, then hardens the server to prevent recurrence. No fluff, just commands and checks.

Diagnose the Root Cause

Start with the basics. If the site is unreachable, is it a DNS issue or a server issue? Run dig example.com from your local machine. If the IP resolves but the site is down, the problem is on the server side.

Check disk space immediately. A full partition stops the web server from writing logs or temporary files. Run df -h to see usage. If any partition is over 90%, clean up logs or move large files to another volume.

Verify the web server process is running. Use systemctl status nginx or systemctl status apache2. If it's stopped, check the error logs in /var/log/nginx/error.log or /var/log/apache2/error.log for clues.

  • dig example.com to verify DNS resolution
  • df -h to check disk usage
  • systemctl status <service> to check process state

Audit Firewall and Network Access

So what if the port is open but SSH still refuses? Or the site is down but ping works? Check your firewall rules. Use ufw status or iptables -L to see what's allowed.

Ensure ports 80 and 443 are open for HTTP and HTTPS. If you use a cloud provider, check the security group rules too. A blocked port looks exactly like a down site to users.

Be careful when opening ports. Only allow necessary traffic. If you expose SSH on port 22, consider moving it to a non-standard port or using key-based authentication only.

  • ufw status to list active firewall rules
  • iptables -L -n to view netfilter rules
  • Check cloud provider security groups if applicable

Harden SSH Access

SSH is the most common entry point for attackers. If your server is compromised, the site may go down due to resource exhaustion or malicious scripts.

Edit /etc/ssh/sshd_config. Set PermitRootLogin no to prevent direct root access. Ensure PasswordAuthentication no is set, forcing key-based login only.

Generate a new SSH key pair if you suspect compromise. Use ssh-keygen -t ed25519 for strong encryption. Add the public key to ~/.ssh/authorized_keys on the server.

Restart the SSH service with systemctl restart sshd. Test the connection from a new terminal before closing the current session to avoid lockout.

  • PermitRootLogin no in sshd_config
  • PasswordAuthentication no for key-only access
  • ssh-keygen -t ed25519 for new keys

Implement Intrusion Prevention

Brute-force attacks on SSH or login forms can saturate CPU and memory, causing the site to become unresponsive. Fail2ban is a standard tool to block these attempts.

Install fail2ban with apt install fail2ban or yum install fail2ban. It monitors logs and bans IPs that exceed a threshold of failed attempts.

Configure /etc/fail2ban/jail.local to set appropriate ban times. A default of 10 minutes is reasonable for SSH. For web login forms, consider 1 hour.

Check the status with fail2ban-client status sshd to see banned IPs. This gives you visibility into ongoing attacks.

  • apt install fail2ban for Debian/Ubuntu
  • yum install fail2ban for RHEL/CentOS
  • fail2ban-client status to monitor bans

Update and Patch the Stack

Outdated software is a security risk. Attackers exploit known vulnerabilities in web servers, PHP, and databases.

Run apt update && apt upgrade or yum update to install the latest patches. Reboot the server if kernel updates are applied.

Check the web server version with nginx -v or apache2 -v. Ensure it's the latest stable release. For PHP, check php -v and update if necessary.

After updating, restart the web server with systemctl restart nginx or systemctl restart apache2. Monitor the logs for any errors during the restart.

  • apt update && apt upgrade for Debian/Ubuntu
  • yum update for RHEL/CentOS
  • nginx -v to check web server version

Verify HTTPS and Certificate Validity

An expired SSL certificate causes browsers to show a warning, which users may interpret as a down site. Check the certificate expiry date.

Use openssl s_client -connect example.com:443 -servername example.com | openssl x509 -noout -dates to see the validity period.

If the certificate is expiring soon, renew it. For Let's Encrypt, use certbot renew --dry-run to test the renewal process.

Ensure the web server is configured to use the new certificate. Restart the service after updating the certificate files.

  • openssl s_client to check certificate dates
  • certbot renew --dry-run to test Let's Encrypt renewal
  • systemctl restart nginx after certificate update

Monitor and Log for Future Incidents

Prevention is better than reaction. Set up monitoring to alert you before the site goes down.

Use tools like Uptime Kuma or Nagios to monitor HTTP status codes and response times. Configure alerts to email or Slack when the site is unreachable.

Enable detailed logging in the web server. For nginx, set log_format to include request time and status code. This helps diagnose slow responses or errors.

Review logs weekly for unusual patterns. A spike in 404s or 500s may indicate an attack or a bug in the application.

  • Uptime Kuma for simple HTTP monitoring
  • Nagios for comprehensive infrastructure monitoring
  • Custom log_format in nginx for detailed request data

Quick troubleshooting checklist

  • Verify DNS propagation using dig or nslookup
  • Check disk usage with df -h and clean logs if over 90%
  • Review firewall rules for blocked application ports
  • Audit SSH configuration for root login and key-based auth
  • Install and configure fail2ban for brute-force protection
  • Update web server and PHP versions to latest stable releases
  • Test HTTPS certificate validity and auto-renewal

FAQ

Why is my website down but the server is running?

The web server process may be crashed or blocked by a firewall. Check the service status with systemctl status nginx or apache, and verify that port 80/443 is open in your firewall rules.

How do I fix a website down caused by a full disk?

Identify large files using du -sh * | sort -h, clear old logs in /var/log, and remove unused packages. Ensure the partition has at least 10% free space for system operations.

What is the first step to secure a server after a security incident?

Isolate the server from the network if possible, rotate all credentials and API keys, and audit access logs for unauthorized IP addresses before applying patches.