1

May I know how do I start a Tornado app on a production server ( ubuntu 10.04 ) and access it on a domain name without the port number in the domain name?

Here's the background information

The location of my tornado app: /srv/www/domain1.com/public_html/src .

The directory structure of src/ is:

src/
   static/
   templates/
   app.py

I intend to host multiple Tornado apps on my server so I am making use of the /etc/nginx/sites-enable and /etc/nginx/sites-available feature.

In my /etc/nginx/sites-available folder, i created a domain1.com.conf file:

server {
    listen 80;
    server_name http://www.domain1.com;
    root /srv/www/domain1.com/public_html/src/static;


    location / {

        try_files $uri @tornado;
    }

    location @tornado {

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass       http://127.0.0.1:8888;
    }
}

After which I made a symbolic link to /etc/nginx/sites-enabled. Than i restarted nginx.

I didnt change the default nginx config file.

After starting tornado app by running python app.py , I can access my app at http://www.domain1.com:8888 If i type attempt to access it at http://www.domain1.com , then I'll see a "Welcome to Nginx" message.

Is there are way I can access my app at http://www.domain1.com/ ?

Best Regards.

1 Answer 1

1

The server_name option should contain a hostname and not an URL. With your example:

server_name www.domain1.com;

The Tornado documentation contains an example with four Tornado instances running behind nginx: http://www.tornadoweb.org/en/stable/guide/running.html

You must log in to answer this question.

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