Sunday, January 23, 2011

nginx proxying different servers for different subdomains

I'm trying to use nginx as a proxy so that http://stuff.theanti9.com/ goes to a seperate computer and everything else goes to a local instance of apache (which would be accessed by http://theanti9.com or http://www.theanti9.com). 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?

  • check the files inside /etc/nginx/conf.d. Something might've overridden your settings

    The.Anti.9 : conf.d is empty.

0 comments:

Post a Comment