[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /root/SCUCourseKiller
# Django's wsgi file
module = SCUCourseKiller.wsgi
# the virtualenv (full path)
# home = /path/to/virtualenv
# /process-related settings
# master
# master = true
# maximum number of worker processes
processes = 2
enable-threads = true
# the socket (use the full path to be safe)
socket = /root/SCUCourseKiller/SCUCourseKiller/docker_app.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clear environment on exit
vacuum = true
nginx
nginx的配置主要注意与uWSGI的通信即可,其余则需要注意static、media路径的转发:
# mysite_nginx.conf
upstream django {
server unix:///root/SCUCourseKiller/SCUCourseKiller/docker_app.sock;
}
# configuration of the server
server {
# the port your site will be served on, default_server indicates that this server block
# is the block to use if no blocks match the server_name
listen 8000 default_server;
# the domain name it will serve for
server_name 0.0.0.0; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
access_log /root/SCUCourseKiller/log/access.log main;
error_log /root/SCUCourseKiller/log/error.log info;
# Django media
location /media {
alias /root/SCUCourseKiller/media; # your Django project's media files - amend as required
}
location /static {
alias /root/SCUCourseKiller/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django; # for a file socket
include /root/SCUCourseKiller/uwsgi_params; # the uwsgi_params file you installed
}
}