一、编译安装nginx:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@Web-Nginx-Server ~]# useradd nginx -s /sbin/nologin -M [root@Web-Nginx-Server ~]# yum install vim -y [root@Web-Nginx-Server ~]# yum install gcc gcc-c++ -y [root@Web-Nginx-Server ~]# yum install wget -y [root@Web-Nginx-Server html]# yum install pcre* [root@Web-Nginx-Server ~]# mkdir -p /byrd/tools [root@Web-Nginx-Server ~]# mkdir /byrd/server [root@Web-Nginx-Server ~]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz [root@Web-Nginx-Server ~]# mv pcre-8.33.tar.gz /byrd/tools/ [root@Web-Nginx-Server tools]# tar zxvf pcre-8.33.tar.gz [root@Web-Nginx-Server tools]# cd pcre-8.33 [root@Web-Nginx-Server pcre-8.33]# ./configure [root@Web-Nginx-Server pcre-8.33]# echo $? 0 [root@Web-Nginx-Server pcre-8.33]# make && make install [root@Web-Nginx-Server pcre-8.33]# cd .. [root@Web-Nginx-Server tools]# wget http://nginx.org/download/nginx-1.6.0.tar.gz [root@Web-Nginx-Server tools]# tar zxf nginx-1.6.0.tar.gz [root@Web-Nginx-Server tools]# cd nginx-1.6.0 [root@Web-Nginx-Server nginx-1.6.0]# ./configure --user=nginx --group=nginx --prefix=/byrd/server/nginx-1.6.0 --with-http_stub_status_module --with-http_ssl_module [root@Web-Nginx-Server nginx-1.6.0]# make && make install [root@Web-Nginx-Server pcre-8.33]# echo $? 0 [root@Web-Nginx-Server nginx-1.6.0]# ln -s /byrd/server/nginx-1.6.0/ /usr/local/nginx [root@Web-Nginx-Server nginx-1.6.0]# /usr/local/nginx/sbin/nginx |
编译安装uWSGI:
0 1 2 3 4 |
[root@Web-Nginx tools]# wget http://projects.unbit.it/downloads/uwsgi-2.0.1.tar.gz [root@Web-Nginx tools]# tar zxf uwsgi-2.0.1.tar.gz [root@Web-Nginx uwsgi-2.0.1]# python setup.py build [root@Web-Nginx uwsgi-2.0.1]# make [root@Web-Nginx uwsgi-2.0.1]# cp uwsgi /usr/bin |
配置nginx:(/usr/local/nginx/conf/ningx.conf)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
server { listen 80; server_name localhost; location / { root html; include uwsgi_params; uwsgi_pass 127.0.0.1:9001; index index.py index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } |
运行uWSGI:
0 |
[root@Web-Nginx default]# uwsgi --socket localhost:9001 --wsgi-file /web/site/default/wsgi.py --master --processes 4 --threads 2 --stats localhost:9191 |
wsgi.py:
0 1 2 3 |
[root@Web-Nginx default]# cat wsgi.py def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return "Hello World" |
到此,去访问你的页面吧!是否看到了很熟悉的内容“hello,world”?SourceByrd's Weblog-https://note.t4x.org/environment/configure-nginx-uwsgi/
参考:http://www.douban.com/note/13508388/
参考:http://cn-popeye.iteye.com/blog/1534649
参考:http://blog.csdn.net/sgbfblog/article/details/8948820
参考:http://www.vimer.cn/2011/07/linux%E4%B8%8Bnginxpythonfastcgi%E9%83%A8%E7%BD%B2%E6%80%BB%E7%BB%93web-py%E7%89%88.html
参考:http://my.oschina.net/guol/blog/121418
参考:http://www.cnblogs.com/txwsqk/archive/2011/03/15/1984792.htmlSourceByrd's Weblog-https://note.t4x.org/environment/configure-nginx-uwsgi/
SourceByrd's Weblog-https://note.t4x.org/environment/configure-nginx-uwsgi/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!