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.

I'm having some trouble setting up a subdomain for clients.lipsmack.co.uk. I've set up a DNS A record to point to my IP address, and I've created proxy and vhost information for nginx and apache, but I'm getting a server not found response when I go to the address.

The Nginx config looks like this:

upstream backend {
    server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name clients.lipsmack.co.uk;

    location / {
        proxy_pass http://backend;
        include /etc/nginx/proxy.conf;
    }
}

And the Apache file reads:

<VirtualHost *:8080>
    ServerName clients.lipsmack.co.uk

    <Directory /path/to/wsgi/parent/dir/>
        Order deny,allow
        Deny from all
    </Directory>

    WSGIDaemonProcess clients.lipsmack.co.uk user=www-data group=www-data threads=25
    WSGIProcessGroup clients.lipsmack.co.uk

    WSGIScriptAlias / /path/to/wsgi/file/
</VirtualHost>

I'm really at a loss as to why it's not working. Can anyone shed any light?

Thank you.

Edit: This problem seems to have resolved itself, though I'm none the wiser as to how. I changed the A record to a CNAME, which did nothing, so I changed it back. After rewriting the config files a few times, it finally worked, though I'm fairly sure I didn't do anything differently. I'd be interested to hear people's thoughts on this...

share|improve this question
    
What exact version of Apache are you using? –  Tim Post Oct 7 '09 at 18:18
    
It's Apache2 (running on Ubuntu Server 9.04 if that makes any difference) –  Gary Chambers Oct 7 '09 at 18:25
1  
DNS name propagation can take a while if this had to be reflected into wider Internet in order to be able to use it. –  Graham Dumpleton Oct 8 '09 at 5:09

1 Answer 1

Try this config:

location / {
    proxy_pass http://backend;
    proxy_set_header  Host       $host;
    include /etc/nginx/proxy.conf;
}

note addition of proxy_set_header Host $host that will forward host header to apache

You also may need to pass

proxy_set_header   X-Forwarded-For $remote_addr;

to apache and then proccess it to get user's IP address.

share|improve this answer

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.