login community faq

I had memory problems serving web2py via apache so was advised to change to uwsgi. I run uwsgi with:

1
2
3
uwsgi --http=127.0.0.1:port --pythonpath path/web2py --module
wsgihandler -d path/uwsgi.log -t 20 --async 24 --ugreen --limit-as 100
-r --no-orphans -M -p 1

How can I configure uwsgi to only serve web2py for certain sub-directories, and the rest as static? For example:

1
2
3
4
domain.com          # static
domain.com/blog     # static
domain.com/chat     # web2py
domain.com/contact  # web2py

asked Jan 04 '12 at 22:31

Baron's gravatar image

Baron
11

edited Jan 04 '12 at 22:32


We don't have any experience serving static content on a subpath within uwsgi, however one of the great advantages of our Control Panel is the ability to serve separate applications on a URL subpath. This is what we would recommend for a number of reasons.

First, pure static content can be served with a static-only application. This employs the webserver's front-end Nginx server to serve the pure static media (images, video, javascript, css, raw html, etc) without creating any load on your application. So, that's better than any static-media handling by web2py or uwsgi because those "mundane" static requests never have to be handled by your application at all.

Second, the control panel supports assigning URL Paths to your website record. This means it is simple and effective to employ a configuration such as:

1
2
3
4
domain.com          # URL Path of "/",        application type "Static Only (no .htaccess)".
domain.com/blog     # URL Path of "/blog",    application type "Static/CGI/PHP-5.3".
domain.com/chat     # URL Path of "/chat",    point to your uwsgi Custom Application (listening on port)
domain.com/contact  # URL Path of "/contact", point to your uwsgi Custom Application (listening on port)

In the above, the domain.com/blog is assumed to be served by a dynamic blog application (such as Wordpress) or other Static/CGI/PHP backend. If it's pure static, it can be a Static Only (no .htaccess) application type instead.

answered Jan 04 '12 at 22:45

ryans's gravatar image

ryans ♦♦
28411420

The easiest way would be to forward this traffic directly to the front-end nginx server. You can do that with a 'symbolic link to static only app' and than updating the website configuration to serve that application at the given URI. More info may be found here.

answered Jan 04 '12 at 22:49

johns's gravatar image

johns ♦♦
340427

Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×18
×11

Asked: Jan 04 '12 at 22:31

Seen: 991 times

Last updated: Jan 04 '12 at 22:49

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited