Nginx 配置文件:
# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8082; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name localhost; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django static
Location ^~/static/ {
alias /root/mysite/static_common/; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /root/mysite/uwsgi_params; # the uwsgi_params file you installed
}
}
Uwsgi配置文件:
[uwsgi]
# Django-related settings
socket = 127.0.0.1:8082 #此处重点,单独的Uwsgi配置使用http
# the base directory (full path)
chdir = /root/mysite
# Django s wsgi file
module = mysite.wsgi
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 1
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
网友评论