Apache 的代理使用 配置

来源:互联网 发布:斯坦李 知乎 编辑:程序博客网 时间:2024/05/16 08:37
1.Apache下载、安装
2.Apache装好之后确认一下安装目录modules下有没有mod_proxy_http.so和mod_proxy.so两个文件
3.在conf文件夹下httpd.conf里面要配置
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
如果存在,把两行最前边的"#"去掉
4.最下面需要配置:ProxyRequests Off


<Proxy *>
Order deny,allow
Allow from all
</Proxy>


ProxyPass /example/   http://localhost:8080/example/

ProxyPassReverse  /example/   http://localhost:8080/example/


 /example/   http://localhost:8080/example/

当访问路径中存在“ /example/ ”,会使用“ http://localhost:8080/example/”把原URL中““ /example/ ””之前的字符串替换掉

如:请求路径http://localhost/example/index.do?method=doLogin

代理后的路径:http://localhost:8080/example/index.do?method=doLogin

原创粉丝点击