server{
listen ;
server_name 0.0.0.0; charset utf-;
access_log /var/log/nginx/access.log main;
location / {
include uwsgi-params;
uwsgi_connect_timeout ;
uwsgi_pass unix:/home/ubuntu/www/taobaok/script/uwsgi.sock;
gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-p\
hp application/json text/json image/jpeg image/gif image/png application/octet-stream; # 支持压缩的类型 }
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
以上为nginx.conf中需要配置的服务器, 关键在uwsgi_pass 设置参数
# uwsig使用配置文件启动
[uwsgi]
#http-socket = :
#socket = 0.0.0.0:
# 项目目录
chdir= /home/ubuntu/www/taobaok
# 指定项目的application
#module=taobaok.wsgi.application
wsgi-file=/home/ubuntu/www/taobaok/taobaok/wsgi.py
# 指定sock的文件路径
socket=/home/ubuntu/www/taobaok/script/uwsgi.sock
#uwsgi_pass=127.0.0.1:;
# 进程个数
workers=
pidfile=/home/ubuntu/www/taobaok/script/uwsgi.pid
# 指定IP端口
http=0.0.0.0:
# 指定静态文件
static-map=/static=/home/ubuntu/www/taobaok/taobaok/
# 启动uwsgi的用户名和用户组
uid=ubuntu
gid=users
chmod-socket=
# 启用主进程
master=true
# 自动移除unix Socket和pid文件当服务停止的时候
vacuum=true
# 序列化接受的内容,如果可能的话
thunder-lock=true
# 启用线程
enable-threads=true
# 设置自中断时间
harakiri=
#
max-requests =
limit-as =
buffer-size= # 设置缓冲
post-buffering=
# 设置日志目录
daemonize=/home/ubuntu/www/taobaok/script/uwsgi.log
以上为uwsgi.ini的配置文件