using nginx with proxy_pass on a subdomain

Posted by marcus3006 on Server Fault See other posts from Server Fault or by marcus3006
Published on 2012-12-08T10:10:54Z Indexed on 2012/12/08 11:13 UTC
Read the original article Hit count: 189

Filed under:
|
|
|
|

a have a rails app that should listen on the subdomain redmine.example.com (using proxy_pass). all other requests for *.example.com should just redirect to a normal index.html. Here is my configuration:

server { server_name www.example.com example.com; root /home/deploy/static/example; }

upstream redmine { server unix:/tmp/redmine.socket fail_timeout=0; }

server {

# you could put a list of other domain names this application answers
server_name redmine.example.com;

root /home/deploy/rails/redmine/public;
access_log /var/log/nginx/redmine_access.log;
rewrite_log on;

location * {
    proxy_pass  http://redmine;
}

location ~ ^/(assets)/  {
    root /home/deploy/rails/redmine/public;
    gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
}

}

anyone knows what's going wrong here? requests to example.com and www.example.com are handled correctly. when i try to acces redmine.example.com => "couldn't resolve host"

© Server Fault or respective owner

Related posts about nginx

Related posts about proxy