I want to deploy my django project with Ubuntu and Digital Ocean. It's not the first time I do it but now I keep getting this error and I don't know what's causing it. I used this video as guide for the process: https://www.youtube.com/watch?v=US9BkvzuIxw. It's really annoying because the only message that I get is "502 Bad Gateway nginx/1.18.0 (Ubuntu)" and what I found on internet to solve it doesn't work. All nginx tests I run say it works correctly. This is the code where I think the error must be:
/etc/nginx/sites-available/locallibrary
server {
server_name vvmwp.nl;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/sammy/locallibrary;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
/etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=sammy
Group=sammy
EnvironmentFile=/home/sammy/locallibrary/env
WorkingDirectory=/home/sammy/locallibrary
ExecStart=/home/sammy/env/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
locallibrary.wsgi:application
[Install]
WantedBy=multi-user.target
/etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
Thanks in advance