1

I have a site example.com that runs off a 'normal' web server ie at the moment Apache but looking to go for a less RAM intensive alternative in future so I don't want mod_WSGI on apache.

Shortly I will be looking to deploy a web app that runs out of a python app server. I want this answering all requests to example.com/reallycoolpythonwebapp/ with the web server looking after the rest.

How is such an architecture created? Am I looking to Pointers to relevant online docs are appreciated.

blippy
  • 143
  • 1
  • 7

3 Answers3

5

you would run your python server on a different port, then make use of Apache's (or any decent webserver like nginx etc) reverse proxy functionality to reverse proxy any requests for example/com/reallycoolpythonwebapp to the python app server

this will also appear transparent to the user as well

some apache config within the example.com vhost might look like this assuming mod_proxy is installed and enabled

ProxyPass /reallycoolpythonwebapp/ http://localhost:3000/
ProxyPassReverse /reallycoolpythonwebapp/ http://localhost:3000/
<Proxy *>
allow from all
</Proxy>
anthonysomerset
  • 3,983
  • 2
  • 20
  • 24
  • 2
    I like this idea. I guess I'd just deploy the changes you describe to the web server, change the app server to accept only 127.0.0.1 connections and everything would work without change to the application? – blippy Jan 10 '12 at 19:10
  • thats correct and it adds a touch of security to your web app if you use any webserver security features like mod_security or http auth – anthonysomerset Jan 12 '12 at 09:59
  • prefer this idea instead of use a single python application server and keep all my apps running by separate. – BlaShadow Apr 04 '13 at 19:24
2

I would probably setup Apache to proxy requests to localhost:xyz (or whatever host/port your python app will be listening on) when the request matches example.com/reallycoolpythonwebapp/

You ought to be able to pull that off with a combination of mod_rewrite (to match the target URL) and mod_proxy.

Relevant Apache docs:

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule

In particular, in the second, note the table entries for:

^/somepath(.*) {url1}$1 [P] {url2}

0

The most common answer is proxy. For starters mod_proxy (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html).

therek
  • 682
  • 5
  • 6