Apache Config for PHP和Web2Py

时间:2013-04-24 04:17:44

标签: apache web2py

我正在为家庭设置服务器以运行各种各样的事情。我会告诉你整个故事,但我试图让它通过WSGI运行Web2Py,但也需要为我拥有的其他Web应用程序提供PHP文件。我尝试了Web2Py的安装脚本,但是“劫持”整个Apache系统以运行Web2Py系统。

该设置目前适用于PHP和SSL页面,但我不能让它也处理Web2Py站点的请求。对于Web2Py url(http://jupiter/web2py),我得到一个Apache目录列表。请帮忙。

目录结构如下:

  • / var / www - > Apache DocumentRoot
  • / var / www / scripts - >各种PHP脚本
  • / var / www / web2py - >的web2py

/ etc / apache2 / sites-available / default文件设置如下:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin me@yahoo.com
    ServerName jupiter.myhome.com

    WSGIDaemonProcess web2py user=www-data group=www-data display-name=%{GROUP}
    WSGIProcessGroup web2py
    WSGIScriptAlias /web2py /var/www/web2py/wsgihandler.py

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

<Directory /var/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow, deny
    allow from all
</Directory>

<Directory /var/www/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
        Allow from all
    </Files>
</Directory>

AliasMatch ^/([^/]+)/static/(.*) /var/www/web2py/applications/$1/static/$2
<Directory /var/www/web2py/applications/*/static/>
    Order Allow,Deny
    Allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

#comment
#comment
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

1 个答案:

答案 0 :(得分:1)

我成功配置了Joomla(PHP)应用程序+ Web2py。你的apache配置似乎没问题。只需确保使用正确的 path_prefix 配置/web2py/routes.py(根据您的示例,它应该是'web2py'):

routers = dict( 
 BASE = dict( 
 default_application='<your_default_app>', 
path_prefix='web2py', 
 ) 
)