WebFaction
Community site: login faq

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

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:

domain.com          # static
domain.com/blog     # static
domain.com/chat     # web2py
domain.com/contact  # web2py

asked 04 Jan '12, 22:31

Baron
136
accept rate: 0%

edited 04 Jan '12, 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:

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.

permanent link

answered 04 Jan '12, 22:45

ryans ♦♦
5.0k93260
accept rate: 43%

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.

permanent link

answered 04 Jan '12, 22:49

johns
5.3k312
accept rate: 23%

Your answer
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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×24
×17

question asked: 04 Jan '12, 22:31

question was seen: 3,456 times

last updated: 04 Jan '12, 22:49

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM