apache代理伺服器配置

看風景就發表於2018-05-29

1. 擴充套件開啟,httpd.conf開啟一下選項

LoadModule proxy modules/proxy.so
LoadModule proxy_connect modules/proxy_connect.so
LoadModule proxy_http modules/proxy_http.so
LoadModule proxy_html modules/proxy_html.so

2. 新增虛擬主機,httpd-vhost.conf中新增如下配置

<VirtualHost *:80>
    ServerName b.test.com
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://192.168.1.166:6281/
    ProxyPassReverse / http://192.168.1.166:6281/
    ProxyPreserveHost On  #讀寫cookie必備
    # ProxyPassReverseCookiePath http://192.168.1.166:6281 /
    # ProxyPassReverseCookieDomain locahost www.domain.cn
</VirtualHost>

以上的配置是用80埠的b.test.com代理http://192.168.1.166:6281/這個地址, 並且實現cookie的正常讀寫。

 

參考:https://segmentfault.com/a/1190000005041026

         http://sharejava.iteye.com/blog/1781872

相關文章