【 Ngnix 】配置路径转发至后端Apache多台虚拟主机

一、安装apache并开启端口

[root@server ~]# netstat -ntplu | grep httpd
tcp        0      0 0.0.0.0:8000                0.0.0.0:*                   LISTEN      1934/httpd          
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      1934/httpd

二、nginx配置

        location ^~ /8080/ {
            proxy_pass http://127.0.0.1:8080/;
      proxy_redirect off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        }
        location ^~ /8000/ {
            proxy_pass http://127.0.0.1:8000/;
      proxy_redirect off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

原文地址:https://www.cnblogs.com/hukey/p/5465512.html