optimistictoaster
optimistictoaster

Reputation: 61

Apache Config for PHP and Web2Py

I'm setting up a server for home to run all sorts of things. I'll save you the whole story, but I'm trying to get it to run Web2Py through WSGI, but also need to serve PHP files for other web apps I have. I tried the install script for Web2Py, but that "hijacked" the entire Apache system to run the Web2Py system.

The setup currently works for PHP and SSL pages, but I cannot get it to also process requests for the Web2Py site. For the Web2Py url (http://jupiter/web2py), I get an Apache directory listing. Please help.

The directory structure is this:

The /etc/apache2/sites-available/default file is setup as this:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin [email protected]
    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

Upvotes: 2

Views: 1050

Answers (1)

micmejia
micmejia

Reputation: 11

I successfully configured a Joomla (PHP) application + Web2py. Your apache config seems ok. Just make sure you configure your /web2py/routes.py with the correct path_prefix (as per your example it should be 'web2py'):

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

Upvotes: 1

Related Questions