通过nginx和uwsgi模块转发python的web.py框架

这是我的配置过程~ 大家参考下~

 
 
  1. #!/bin/bash

  2. wget -c http://rfyiamcool.googlecode.com/files/pcre-8.13.tar.gz

  3. tar zxvf pcre-8.13.tar.gz

  4. cd pcre-8.13/

  5. ./configure

  6. make && make install

  7. cd ../

  8. useradd www

  9. wget -c http://rfyiamcool.googlecode.com/files/nginx-1.2.0.tar.gz

  10. tar zxvf nginx-1.2.0.tar.gz

  11. cd nginx-1.2.0

  12. ./configure --user=www--group=www--prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6

  13. make && make install

  14. cd ..

  15. wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz

  16. cd uwsgi-1.3/

  17. python uwsgiconfig.py --build

  18. \cp nginx/uwsgi_params /usr/local/nginx/conf/ -f

  19. vi /usr/local/nginx/conf/nginx.conf

  20. server {

  21.        listen        80;

  22.        server_name localhost;

  23.        location / {

  24.            root  /usr/local/nginx/html;

  25.            include uwsgi_params;

  26.            uwsgi_pass 127.0.0.1:8000;

  27.        }

  28. }

  29. /usr/local/nginx/sbin/nginx

  30. cd /usr/local/nginx/html

  31. vi uwsgi.xml

  32. <uwsgi>

  33. <socket>127.0.0.1:8000</socket>

  34. <module>myuwsgi</module>

  35. <master/>

  36. <pythonpath>/usr/local/nginx/html</pythonpath>

  37. <processes>2</processes>

  38. </uwsgi>

  39. vi   web.py

  40. #!/usr/bin/env python

  41. import os

  42. import web

  43. urls = ('/(.*)', 'hello')

  44. app = web.application(urls, globals())

  45. class hello:

  46.    def GET(self, name):

  47.        if not name:

  48. name = "World"

  49.        return "Hello" + name + "!"

  50. appapplication = app.wsgifunc()

  51. 启动

  52. /usr/local/uwsgi-1.3/uwsgi -x /usr/local/nginx/html/uwsgi.xml --daemonize /usr/local/nginx/html/uwsgi.error.log

  53. 停止uWSGI

  54. killall -9 uwsgi

  55. 排错

  56. netstat -an|grep -E '(8000|80)'

  57. ps aux|grep uwsgi



你可能感兴趣的:(nginx,web.py,web.py,web.py,uwsgi,uwsgi)