Connected Tutorial(This question is a follow-up to this tutorial):
How To Host a Website Using Cloudflare and Nginx on Ubuntu 18.04I have a Django app running with Nginx + Gunicorn. Before, I had a Let’s Encrypt Certificate and Cloudflare SSL encryption mode as Full. After deleting the Let’s Encrypt Cert and modifying everything on my Nginx server I followed this tutorial. Now every request returns 503.
Nginx /sites-enabled/:
server {
listen 80;
listen [::]:80;
server_name my-site.com www.my-site.com;
return 302 https://$server_name$request_uri;
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl on;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
ssl_client_certificate /etc/ssl/cloudflare.crt;
ssl_verify_client on;
server_name my-site.com www.my-site.com;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location /static/ {
root /home/sammy/myproject/app;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
Every status shows that everything is running and active.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Found the solution to this nightmare: Instead of being a problem with Cloudflare’s SSL - altough my first thoughts were related to it because I changed the LetsEncrypt SSL certificate first - it was, indeed, a problem with how Nginx connects to Gunicorn. The server’s Nginx config is alright but the Gunicorn service was located in another folder, not in the one written in the OP.
Hi there,
What I could suggest is checking your Nginx error log so you could see the actual error rather than the generic 503 error:
- tail -100 /var/log/nginx/error.log
Feel free to share the error here as well so I could try to advise you further.
Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.