How do I get my site working again? (Ubuntu 16.04)
My site is not working from yesterday.
Initially I had a "Error establishing a database connection" error.
I logged into cloud.linode.com and did a reboot.
After that I am getting a site can't be reached error.
Below are some information that could help.
root@ndlf:~# iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
root@ndlf:~# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 973/sshd
tcp6 0 0 :::22 :::* LISTEN 973/sshd
root@ndlf:~# curl -IL 127.0.0.1
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
1 Reply
The netstat command shows that you only have SSH listening on port 22. For your site to be working, you'd likely also want either nginx or apache2 to be listening on port 80. If you have a database, you'll want to see mySQL listening on port 3306.
I'd recommend starting each of these, and enabling them so that they automatically start on boot. If you are using nginx instead, simply replace apache2 with nginx in the commands below.
sudo systemctl restart apache2
sudo systemctl enable apache2
sudo systemctl restart mysql
sudo systemctl enable mysql
For more on this, and for reviewing the log files for these services check out our guide for Troubleshooting Web Servers and Databases