I am trying to get my Django app running on a VPS and I did everything according to this tutorial, but I am getting a 502 error.
I assume that nginx is listening to port 80 (am I right?), because sudo netstat -nlp | grep 80
throws:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 892/nginx
tcp6 0 0 :::80 :::* LISTEN 892/nginx
unix 2 [ ACC ] STREAM LISTENING 8942 805/acpid /var/run/acpid.socket
But when I enter sudo nginx
it seems that Nginx is not listening to port 80 ...:
`nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()`
My Nginx configuration:
server {
server_name 95.85.34.87;
access_log off;
location /static/ {
alias /opt/myenv/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
Could anyone help me ?