Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

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>
share|improve this answer
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? –  rutherford 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 9:59
    
prefer this idea instead of use a single python application server and keep all my apps running by separate. –  BlaShadow Apr 4 '13 at 19:24
add comment

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}

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.