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.

this is my first web app deployment and am running into all sorts of issues.

I am currently going for a nginx + gunicorn implementation for the Django app, but mostly this question relates to nginx configurations. For some context - nginx would receive connections and proxy to the gunicorn local server.

in the nginx configurations, where it says server_name do I have to provide one? I don't plan to use domain names of any kind, just through my network's external ip (it is static) and the port number to listen to.

My desire is that when I access something like http://xxx.xxx.xxx.xxx:9050 I would be able to get the site.

The following is the sample code that I will base the configurations on for reference.

   server {
        listen   80;
        server_name WHAT TO PUT HERE?;

    root /path/to/test/hello;

    location /media/ {
        # if asset versioning is used
        if ($query_string) {
            expires max;
        }
    }
    location /admin/media/ {
        # this changes depending on your python version
        root /path/to/test/lib/python2.6/site-packages/django/contrib;
    }
    location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 10;
        proxy_read_timeout 10;
        proxy_pass http://localhost:8000/;
    }
        # what to serve if upstream is not available or crashes
        error_page 500 502 503 504 /media/50x.html;
     }
share|improve this question

1 Answer 1

up vote 4 down vote accepted

server_name defaults to an empty string, which is fine; you can exclude it completely.

Another common approach for the "I don't want to put a name on this" need is to use server_name _;

Your http://xxx.xxx.xxx.xxx:9050 URL won't work with this config, though; you're only listening on port 80. You'd need to add a listen 9050; as well.

share|improve this answer
    
thanks! I'll try it out! –  bash- Jan 19 '12 at 17:07

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.