CloudFlare is showing a Bad Gateway error for my website
I have my website hosted on Linode, and I use CloudFlare as well, but when I visit my website CloudFlare shows a Bad Gateway error. How can I troubleshoot this?
1 Reply
You can troubleshoot this in a few ways:
First, make sure that you gave CloudFlare the right IP for your Linode. Your Linode's IPs are listed in the Remote Access tab.
If that is set up correctly, you should troubleshoot your web server to make sure it's accepting connections normally. You can run this curl command to request the website directly from the web server:
curl -H "Host: <your domain name>" <your IP address>
You can check to see if your web server is running by using this command:
sudo netstat -plntu
You can check if your firewall might be blocking your web server connections:
sudo iptables -nvL
We have a guide for managing your iptables rules:
Control Network Traffic with iptables
You can also check your web server's logs to see if it's producing any errors. If you're using Nginx, then the the log location is usually /var/log/nginx/error.log
. Having said that, your configuration might specify another log location. You can run this command to check for other error logs:
grep -R error_log /etc/nginx
You can then review this log with a command like tail
or less
. If you find any errors you don't understand, you can try pasting them here or searching for them on Google.