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.

How would someone go about setting up wildcard sub-domains with the suggested Tornado deployment? Specifically for SaaS apps that would allow users to have http://username.example.com/ As well as letting them point their own domain to that URL.

share|improve this question
    
What suggested Tornado deployment? –  womble Oct 21 '09 at 2:41

2 Answers 2

nginx would just sit in front of Tornado so assuming the standard proxy config (the Tornado pages should list a basic nginx config).

Wildcard config would be as follows (cribbed from here):

server {
    # Replace this port with the right one for your requirements
    listen       80;  

    # Multiple hostnames separated by spaces.  Replace these as well.
    server_name  star.yourdomain.com *.yourdomain.com www.*.yourdomain.com;  
    root /PATH/TO/yourdomain.com/$host;
    error_page  404              http://yourdomain.com/errors/404.html;
    access_log  logs/access.log;
    location / {
        root   /PATH/TO/yourdomain.com/$host/;
        index  index.php;
    }

    # serve static files directly
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {
        access_log        off;
        expires           30d;
    }

    location / {

      # insert the various proxy pass directives

    }

 }
share|improve this answer
    
This works but add root in location block is not good wiki.nginx.org/Pitfalls#Root_inside_Location_Block –  gagarine Feb 19 '12 at 0:12

Some relevant info here:

http://groups.google.com/group/python-tornado/browse_thread/thread/a9ab17c793230977?pli=1

share|improve this answer
5  
On ServerFault, we greatly prefer content over links to content since things disappear on the web all the time. Please provide a summary of what a link covers in more detail. –  sysadmin1138 Jan 4 '12 at 1:47

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.