I'm just making webserver with django.
Now, I want to publish Django by uwsgi+Nginx, So I read some documents(http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html). While following that doc, I met some errors.
When I connect to mydomain.com:8000, It throws 502 Bad Gateway error. (Actually, when I worked, changed mydomain.com to real domain that I have)
After error, /var/log/nginx/error.log is in below.
2018/02/20 14:56:15 [error] 7548#7548: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.30.1.254, server: mydomain.com, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "mydomain.com:8000"
^C
This is my configure files.
[project_rest.conf]
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000
# the domain name it will serve for
server_name .mydomain.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/app/project_rest/media;
}
location /static {
alias /home/app/project_rest/static;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/app/project_rest/uwsgi_params; # the uwsgi_params file you installed
}
}
(I made that conf file in my django project's folder and linked to /etc/nginx/sites-enabled)
How can I connect to my server?
I can't find where is error occured.
Thanks.
connection refusedthen most probably you have a problem not with nginx but with uwsgi, check uwsgi service is it up or notpython manage.py runserver 0.0.0.0:8000is it working with your_ip:8000?