4

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...

3
  • What exact version of Apache are you using?
    – Tim Post
    Oct 7, 2009 at 18:18
  • It's Apache2 (running on Ubuntu Server 9.04 if that makes any difference) Oct 7, 2009 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. Oct 8, 2009 at 5:09

1 Answer 1

3

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.

You must log in to answer this question.

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