mod_wsgi deployment question

8 views
Skip to first unread message

vince

unread,
Dec 18, 2008, 2:35:56 AM12/18/08
to web2py Web Framework
anyone have experience with mod_wsgi deployment?

i use the manual's sample config but it didn't work straight away. i
have to remove the line
Alias / /home/web2py/applications/
it works but then all the /static/ page are serve via web2py instead
of apache directly.

it seems that once i have set the Alias the WSGIScriptAlias will be
ignore. anyone have the solution to have all the static page skip
mod_wsgi?

thanks in advance
vince

here's my config

<VirtualHost 10.10.10.2:80>
ServerName 10.10.10.2
### alias the location of applications (for static files)
#Alias / /home/web2py/applications/
### setup WSGI
WSGIScriptAlias / /home/web2py/wsgihandler.py
WSGIDaemonProcess web2py user=www-data group=www-data \
home=/home/web2py/ \
processes=10 maximum-requests=500
### static files do not need WSGI
<LocationMatch "ˆ(/[\w_]*/static/.*)">
Order Allow,Deny
Allow from all
</LocationMatch>
### everything else goes over WSGI
<Location "/">
Order deny,allow
Allow from all
WSGIProcessGroup web2py
</Location>
</VirtualHost>


Johanm

unread,
Dec 18, 2008, 2:48:25 AM12/18/08
to web2py Web Framework
I got some help with this a week or so ago. I found the manual to be
more confusing than helpful.
http://groups.google.com/group/web2py/browse_thread/thread/f4197ddc6f8f46bc/7be254ed84961d40?lnk=gst&q=ubuntu#7be254ed84961d40

Here is my working config file
note that i had to put my wsgi handlers outside the <VirtualHost> tags
so it would work for both HTTP and HTTPS



WSGIScriptAlias / /var/www/web2py/wsgihandler.py
WSGIDaemonProcess web2py user=web2py group=web2py home=/var/
www/web2py processes=1 maximum-requests=1000
<VirtualHost *:80>
#WSGIScriptAlias / /var/www/web2py/wsgihandler.py
#WSGIDaemonProcess web2py user=web2py group=web2py home=/var/
www/web2py processes=1 maximum-requests=1000
ServerAdmin webmaster@localhost
DocumentRoot /var/www/web2py/applications
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
NameVirtualHost *:443
<VirtualHost *:443>
ServerAdmin webmaster@localhost
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
DocumentRoot /var/www/web2py/applications/admin
#WSGIScriptAlias / /var/www/web2py/wsgihandler.py
#WSGIDaemonProcess web2py user=web2py group=web2py home=/var/
www/web2py processes=1 maximum-requests=1000
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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 /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>

vince

unread,
Dec 18, 2008, 3:45:33 AM12/18/08
to web2py Web Framework
thanks your config works fine.
but those files under static still serving by web2py.

-vince

On Dec 18, 3:48 pm, Johanm <johan.micke...@gmail.com> wrote:
> I got some help with this a week or so ago. I found the manual to be
> more confusing than helpful.http://groups.google.com/group/web2py/browse_thread/thread/f4197ddc6f...

achipa

unread,
Dec 18, 2008, 6:31:31 AM12/18/08
to web2py Web Framework
Without checking it myself, I'd say you could use mod_rewrite for that
(although it's not for the faint at heart). Have the WSGIScriptAlias
set at /web2py/ and then with a mod_rewrite statement, point paths
without static into /web2py/... and keep the static pointing at the
right place.

I do have to note that if you're going through WSGI web2py already has
minimal overhead so I'm not sure you would gain much by doing this
(you might want to consider using lighttpd or some other lighter http
daemon for serving static content for a more significant gain).
Reply all
Reply to author
Forward
0 new messages