nginx proxying different servers for different subdomains

Posted by The.Anti.9 on Server Fault See other posts from Server Fault or by The.Anti.9
Published on 2010-05-19T03:28:57Z Indexed on 2010/05/19 3:32 UTC
Read the original article Hit count: 249

Filed under:
|

i just set up an nginx server. On the same computer as nginx, I have apache running on port 8000 (this was previously set up.) and I want no subdomain and the www. subdomain to go to the local apache instance. But i want the stuff. subdomain to link to my server where i keep all my miscellaneous files (pictures, documents, etc.), which is also listening on port 80 at the ip 192.168.1.102. I tried configuring it, but when i go to my domain, I just get the "Welcome to nginx!". Here's what I have:

user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;



    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
    server {
           listen 80;
           server_name theanti9.com www.theanti9.com;
       access_log   /var/log/nginx/access.log;
           location / {
                proxy_pass http://localhost:8000;
           }
    }

    server {
           listen 80;
       server_name stuff.theanti9.com;
       access_log   /var/log/nginx/access.log;
       location / {
            proxy_pass http://192.168.1.102:80;
       }
    }
}

I'm not really sure what's wrong. Any suggestions?

© Server Fault or respective owner

Related posts about nginx

Related posts about proxy