Answer the question
In order to leave comments, you need to log in
django+uWSGI+nginx server setup, no .sock file?
Structure
/data # Shared directory for projects on the server
-------- mysite # Directory for the site mysite
-------- -------- conf # Configuration files for the web server mysite_nginx. conf mysite_uwsgi.ini
-------- -------- project # Project code
-------- -------- --------firstsite # Here settings wsgi
-------- -------- venv # Directory for virtual environment
# mysite_nginx.conf
# the upstream component nginx needs to connect to
# Если будете настраивать несколько django сайтов - измените название upstream
upstream django {
server unix:///data/mysite/mysite.sock; # for a file socket
}
# configuration of the server
server {
listen 80; # порт на котором будет доступен ваш сайт
server_name .example.com; # доменное имя сайта
charset utf-8;
client_max_body_size 75M; # max upload size
# Django media
location /media {
alias /data/mysite/project/media;
}
location /static {
alias /data/mysite/project/static;
}
location / {
uwsgi_pass django;
include uwsgi_params;
}
}
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /data/mysite/project
# Django's wsgi file
module = project.wsgi
# the virtualenv (full path)
home = /data/mysite/env/virtualenv
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket
socket = /data/mysite/mysite.sock
# ... with appropriate permissions - may be needed
chmod-socket = 664
# clear environment on exit
vacuum = true
# account to start process
uid = www-data
gid = www-data
# Output messages to log
daemonize=/var/log/uwsgi/mysite.log
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question