uwsgi+nginx环境中在nginx.conf配置
# nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name pc.news.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location ~ ^/pc/ {
include uwsgi_params;
uwsgi_pass unix:/var/run/django.socket;
uwsgi_param UWSGI_SCRIPT testsite.wsgi;
uwsgi_param UWSGI_CHDIR /opt/testsite/;
index index.html index.html;
client_max_body_size 35M;
}
}
server {
listen 80;
server_name mobile.news.com;
location ~ ^/mobile/ {
include uwsgi_params;
uwsgi_pass unix:/var/run/django.socket;
uwsgi_param UWSGI_SCRIPT testsite.wsgi;
uwsgi_param UWSGI_CHDIR /opt/testsite/;
index index.html index.html;
client_max_body_size 35M;
}
}
}