Nginx dispatches the request to apache.

Since nginx listen the port 80, and apache can not listen on port 80.  But we may still want to use 80 port to acess the app that is hosted on the apache server. We can use nginx to dispatch the request to apache.

......

    server {
        listen       80;
        server_name  127.0.0.1;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #location / {
        #    root   html;
        #    index  index.html index.htm;
        #}
        location /appname{
            proxy_pass    http://10.197.43.138:81/appname;
            #proxy_redirect default ;
            #proxy_set_header  X-Real-IP $remote_addr;
            proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header  Host $http_host;
        }

  }

......

posted on 2012-05-09 12:59  jmbkeyes  阅读(192)  评论(0)    收藏  举报

导航