mysite_nginx.conf 配置内容
# 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:8001; # 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 192.168.1.247; # substitute your machine's IP address or FQDN
charset utf-8;
proxy_buffer_size 1024M;
proxy_buffers 4 1024M;
proxy_busy_buffers_size 1024M;
proxy_temp_file_write_size 1024M;
# max upload size
client_max_body_size 3000M; # adjust to taste
# Django media
location /media {
alias /home/aa/www/media; # your Django project's media files - amend as required
}
location /static {
alias /home/aa/www/static;
# your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
proxy_buffer_size 1024M;
proxy_buffers 4 1024M;
proxy_busy_buffers_size 1024M;
proxy_temp_file_write_size 1024M;
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
}
}
mysite_uwsgi.ini 配置文件
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/aa/www/
# Django's wsgi file
module = www.wsgi
# the virtualenv (full path)
home = /home/aa/virtualenvs/www
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = 127.0.0.1:8001
#socket = /home/aa/www/mysite.sock
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
daemonize=/home/aa/www/uwsgi.log