2

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.

1
  • What suggested Tornado deployment?
    – womble
    Oct 21, 2009 at 2:41

1 Answer 1

3

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

    }

 }
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .