1、安装nginx,这里不多做介绍
2、安装django,这里不多做介绍
配置nginx
server {
listen 80;
server_name www.test.com;
location / {
fastcgi_pass 127.0.0.1:8080;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param pass_header Authorization;
fastcgi_intercept_errors off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
配置django
#easy_install flup
添加项目目录到环境变量PYTHONPATH
开启django cgi
切换到django项目目录
python manage.py runfcgi host=127.0.0.1 port=8080 --settings=settings
setting则是配置文件,根据不同位置相应修改