Apache Proxy 配置

  • httpd.conf 中打开VirtualHost配置
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
  • httpd-vhosts.conf 中加入以下配置

    ServerAdmin [email protected]
    ServerName site.com
    ServerAlias www.site.com 

    ProxyRequests off

    
        Order deny,allow
        Allow from all
    

        ProxyPass /api http://localhost:9090/
        ProxyPassReverse /api http://localhost:9090/
        ProxyPass / http://localhost:8100/
        ProxyPassReverse / http://localhost:8100/

  • 其中ServerName和ServerAlias是匹配的域名
  • ProxyPass 和ProxyPassReverse 为要代理的真实地址,两者设置要相同

你可能感兴趣的:(Apache Proxy 配置)