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.

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"

SOLUTION: I forgot to enable the subdomains in my dns file... this nginx config posted here works.

share|improve this question
SSH into the box running Nginx. What's the output of the following command: host redmine? –  jamieb Dec 17 '12 at 15:43
Then i get Host redmine not found: 3(NXDOMAIN) –  marcus3006 Dec 17 '12 at 21:00
That's your problem then. Change the hostname in proxy_pass http://redmine; to something that can be resolved from your Nginx box. –  jamieb Dec 17 '12 at 22:29
But why can't nginx access the hostname. Ut's specified via upstream redmine and accessible? –  marcus3006 Jan 28 '13 at 12:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.