转载地址:
https://www.zhihu.com/question/22850801/answer/117333061
http://www.cnblogs.com/fnng/p/5268633.html
http://www.cnblogs.com/alex3714/p/6538374.html
添加下面的内容:
#### 配置/etc/nginx/nginx.conf:
##### 重启nginx:
##### 运行,在mysite_uwsgi.ini所在文件下输入:
##### 参考:
( 通过Nginx部署Django(基于ubuntu))
( NGINX配置多域名)
https://www.zhihu.com/question/22850801/answer/117333061
http://www.cnblogs.com/fnng/p/5268633.html
http://www.cnblogs.com/alex3714/p/6538374.html
##### 安装nginx,django
##### 在项目下创建mysite_uwsgi.ini:添加下面的内容:
```
# myweb_uwsgi.ini file
[uwsgi]
# Django-related settings
socket = :8000
# the base directory (full path)
chdir = /home/www/mysite # Django s wsgi file
module = myweb.wsgi # process-related settings # master
master = true # maximum number of worker processes
processes = 4
# ... with appropriate permissions - may be needed # chmod-socket = 664 # clear environment on exit
vacuum = true
```
#### 配置/etc/nginx/nginx.conf:
```
http{
server
{
listen 80;
server_name blog.nothing.ml
charset UTF-8;
access_log /var/log/nginx/mysite_access.log;
error_log /var/log/nginx/mysite_error.log;
client_max_body_size 75M;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_read_timeout 2;
}
location /static {
expires 30d;
autoindex on;
add_header Cache-Control private;
alias /home/www/mysite/static;
}
}
....
```
##### 重启nginx:
>/etc/init.d/nginx restart
##### 运行,在mysite_uwsgi.ini所在文件下输入:
>uwsgi --ini mysite_uwsgi.ini
##### 参考:
( 通过Nginx部署Django(基于ubuntu))
( NGINX配置多域名)