connection refused

October 30, 2019 242 views
Nginx Django

This is the configuration file of nginx but I get connection refused error

server {
charset UTF-8;
listen 80;
servername my ip;
root /var/www/language/videosapp;
access
log /var/log/videosapp/nginx/access.log;
errorlog /var/log/videosapp/nginx/error.log;
client
maxbodysize 50M;

location /static {
alias /var/www/videosapp/static;
}
location /media {
alias /var/www/videosapp/media;
}
location /{
proxypassheader Server;
proxysetheader Host $httphost;
proxy
redirect off;
proxyreadtimeout 300;
uwsgireadtimeout 3600;
proxyconnecttimeout 300;
proxypass http://127.0.0.1:8000;
proxy
setheader X-Forwarder-Host $servername;
proxysetheader X-Real-IP $remoteaddr;
add
header P3P ‘CP=“ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV”’;
}
}

1 Answer

Hi @chefvillas,

Can you check one of the following

First, please make sure Nginx is actually listening on port 80

netstat -tulpen | grep port 80

Once you have confirmed that, I’ve noticed you are using proxy pass with port 8000. Is anything listening to that port 8000?

Additionally, I’ll recommend checking your Nginx error log. It should display the error and the reason behind the error.

Regards,
KDSys

  • hello

    thanks a trillion for answering (as I am struggling with this setup for a week so far)

    in the customized error log I created I get:

    Connection refused) while connecting to upstream, client: myhome.ip, server: mydomain.name

    and in the nginx built-in error log I got>
    in the nginx error.log I got: 2019/10/30 10:40:04 [emerg] 12209#12209: host not found in upstream “app_server” in /etc/nginx/sites-enabled/languagefile:27

    I have removed the other proxy line you mentioned

    UPDATE:

    Before I got a 502 bad gateway
    Now I get the 404

    which sounds better, I hope. I am going to see what I can find.

Have another answer? Share your knowledge.