i am new to configuring server. And i want to configure my Amazon-EC2 instance. I configured it according to this document. http://www.soundrenalin.com/about
However when i click the url, 502 Bad Gateway
error is being encountered.
My project is located at this path: /home/ubuntu/dsn/app
.
And the /home/ubuntu/dsn
folder tree is:
app/
app.py
static/
templates/
themes/
bin/
build/
include/
lib/
local/
run.py
Here is my nginx config (/etc/nginx/sites-available/default
):
server {
listen 80;
root /home/ubuntu/dsn/app
index index.html index.htm;
server_name localhost;
location / { try_files $uri @app; }
location @app {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
}
}
And here is my uwsgi.ini
file:
[uwsgi]
chdir = /home/ubuntu/dsn/
uid = www-data
gid = www-data
chmod-socket = 666
socket = /tmp/uwsgi.sock
module = run
virtualenv = /home/ubuntu/dsn/
And the other thing is:
When i run the command tail -f /var/log/nginx/error.log
result is:
2013/06/09 15:58:11 [error] 5321#0: *1 connect() to unix:/tmp/uwsgi.sock failed (111: Connection refused) while connecting to upstream, client: <myip>, server: localhost, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/tmp/uwsgi.sock:", host: "54.218.14.213"
How can i solve this? Thanks.
It could be one of the following things:
If you installed Uwsgi on Ubuntu 12.04, the config file should be located at:
Here's the default socket config in that file:
You should create an app-specific config file that looks similar to mine. I can confirm it works inside a virtual environment.
The contents of your-app.ini:
To enable, you need to symlink and restart nginx.
From https://stackoverflow.com/a/33587478/260127
You can use ubutu's upstart, and uwsgi's --emperor option to execute the python uwsgi apps easily.