Windows下nginx+web.py+fastcgi服务搭建

1.安装python2.7
去官网下载python2.7对应的windows安装包,32位或者64位(我安装的是64位windows,所以资源是64位)python官网:https://www.python.org/downloads/
下载完解压,修改环境变量:

出现:

则python配置成功。

2.安装web.py
下载地址:http://webpy.org/install.zh-cn
解压,cd进入该目录执行python setup.py install

创建的demo测试一下test.py:

#!/usr/bin/env python

#coding=UTF-8


import  web
 
urls  =  ( '/hello' 'hello' ,
        )
 
class  hello( object ):
   def  GET( self ):
     return  'hello world'
 
if  __name__  = =  "__main__" :
   app  =  web.application(urls,  globals ())
   app.run()

执行python test.py
出现:

成功。
3.安装flup:
http://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz

3.安装nginx
http://nginx.org/en/download.html

4.配置nginx
location / {
          root   D:\www/yourwebapp;

          fastcgi_pass   127.0.0.1:8000;
          fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
          include       fastcgi_params;
       }


执行重启nginx服务命令:
nginx -s stop
nginx -t
start nginx







你可能感兴趣的:(Python)