码迷,mamicode.com
首页 > 编程语言 > 详细

Apache + mod_wsgi (Python)部署webpy应用

时间:2015-01-15 12:48:43      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:

1. 搭建 Apache 服务器

  (1). 下载 Httpd 及依赖 -- apr、apr-util

    httpd : http://httpd.apache.org/

    apr & apr-util : https://apr.apache.org/

  (2). 编译 

    apr :
$ ./configure --prefix=/usr/local/apr
$ make & sudo make install

 

    apr-util : 
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make & sudo make install

 

    httpd :     
$ ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --sysconfdir=/etc/ --enable-modules=all --enable-mpms-shared=all

$ make & sudo make install

 

2. 配置 wsgi 框架

  1. 下载mod_wsgi.so模块文件 : http://code.google.com/p/modwsgi

  2. 编译安装: 

$ ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/python

$ make & sudo make install

 

  3. 配置 httpd.conf 文件 : 

LoadModule wsgi_module modules/mod_wsgi.so

<IfModule wsgi_module>
    WSGIScriptAlias /webapp /var/www/webpy-app/code.py/

    Alias /webapp/static /var/www/webpy-app/static/
    AddType text/html .py

    <Directory /var/www/webpy-app/>
        AllowOverride all
        Options Indexes FollowSymLinks ExecCGI
        Order deny,allow
        SetHandler wsgi-script
        Allow from all
    </Directory>
</IfModule>

ServerName 127.0.1.1:80

PS : 将 Request 注释,如下 : 

<Directory />
    AllowOverride none
    # Require all denied
</Directory>

 

Apache + mod_wsgi (Python)部署webpy应用

标签:

原文地址:http://www.cnblogs.com/naray/p/4225807.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!