django官方已经开始弃用fastcgi来部署django应用了,作为以前使用过的用户,还是贴一个配置,用来做纪念吧。。
项目下
#! /bin/sh
case "[email protected]" in
start)
python manage.py runfcgi host=127.0.0.1 port=8400
;;
stop)
kill -9 `ps aux|grep runfcgi|grep 8400|awk ‘{print $2}‘|xargs`
;;
restart)
kill -9 `ps aux|grep runfcgi|grep 8400|awk ‘{print $2}‘|xargs`
sleep 1
python manage.py runfcgi host=127.0.0.1 port=8400
;;
*)
echo ‘unknown arguments‘
exit 1
;;
esac
nginx 配置
server {
listen 80;
server_name 127.0.0.1;
access_log /var/log/nginx/vsite.access_log;
error_log /var/log/nginx/vsite.error_log;
location ^~/media {
alias /data/test/vsite/staticfiles;
}
location ^~/upload {
alias /data/test/vsite/uploadfiles;
}
location ^~/static {
alias /data/test/vsite/staticfiles;
}
location / {
# host and port to fastcgi server
fastcgi_pass 127.0.0.1:8401;
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_pass_header Authorization;
fastcgi_intercept_errors off;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
}
}
声明:
本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/44851755
时间: 2024-11-06 19:04:50