I have domain mydomain.me in godaddy i set it to point to my ip in aliyun ecs
In my diango settings i have :
ALLOWED_HOSTS = [".mydomain.me","x.x.x.x"]
in /etc/nginx/sites-avaiable/Django i have
upstream django {
server unix:/tmp/uwsgi.sock;
}
server {
listen x.x.x.x:80;
server_name .mydomain.me;
location /static/ {
include uwsgi_params;
alias /root/DjangoApps/mydomain_me/public;
}
location / {
include uwsgi_params;
uwsgi_pass django;
}
}
**edit : ** for which I made symlink /etc/nginx/sites-enabled/Django, and removed default symlink.
In uwsgi.ini i have
[uwsgi]
chdir = /root/DjangoApps/mydomain_me
module = mydomain_me.wsgi:application
processes = 1
threads = 1
stats = 127.0.0.1:9000
daemonize = /tmp/daemon_app
pidfile = /tmp/uwsgi.pid
chmod-socket = 777
master = True
vaccum = True
socket = /tmp/uwsgi.sock
i run this as follows with pycharm:
ssh://[email protected]:22/opt/miniconda3/envs/DjangoApps/bin/python3.6 -u /root/DjangoApps/mydomain_me/manage.py runserver 0.0.0.0:8080
ssh://[email protected]:22:bash
root@mydomain:~/DjangoApps/mydomain_me# . activate DjangoApps
(DjangoApps) root@mydomain:~/DjangoApps/mydomain_me# uwsgi uwsgi.ini
(DjangoApps) root@mydomain:~/DjangoApps/mydomain_me# service nginx restart
this is ok:
http://mydomain.me:8080
It worked!
Congratulations on your first Django-powered page.
Next, start your first app by running python manage.py startapp [app_label].
You're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work!
but rhis is not:
http://mydomain.me
with output:
Welcome to nginx!
why its not working?
edit
now mydomain.me gives output:
502 Bad Gateway
nginx/1.10.3 (Ubuntu)
And this are my authorization rules:
outbound:
Allow
Custom TCP
8080/8080 and 80/80 and 22/22 and 3389/3389
Address Field Access
0.0.0.0/0
inbound:
none
Should I change anything? Also my domain point to internet IP address, not elastic one.
edit 1: cat /var/log/nginx/error.log gives me output:
> 2017/08/13 03:00:34 [error] 19132#19132: *11 connect() to
> unix:/tmp/uwsgi.sock failed (111: Connection refused) while connecting
> to upstream, client: x.x.x.x, server: mydomain.me, request:
> "GET /favicon.ico HTTP/1.1", upstream:
> "uwsgi://unix:/tmp/uwsgi.sock:", host: "mydomain.me", referrer:
> "http://mydomain.me/"
And the file /tmp/uwsgi.sock exists, but when:
cat /tmp/uwsgi.sock
it says:
> cat: /tmp/uwsgi.sock: No such device or address