Apache服务器中设置端口映射和反向代理的方法

在/etc/httpd/conf路径下的httpd.conf文件
###new add for webui.cong###
Include "E:/local/Wamp/bin/apache/Apache2.2.17/conf/webui_port.conf"
Include "E:/local/Wamp/bin/apache/Apache2.2.17/conf/webui_proxy.conf"
webui_port.conf文件
#proxy本地端口映射
DocumentRoot "E:/www/yingshe/"
Options -Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all DirectoryIndex index.php
</VirtualHost>
ProxyPass /yingshe http://192.168.10.12:8080/
ProxyPassReverse /yingshe http://192.168.10.12:8080/
<proxy http://192.168.10.12:8080/>
AllowOverride None
Order Deny,Allow
Allow from all
</proxy>
webui_proxy.conf文件
#proxy远程反响代理
Listen 8002
<VirtualHost *:8002>
SSLProxyEngine on
ProxyRequests on
ProxyPass / https://192.168.10.201/
ProxyPassReverse / https://192.168.10.201/
<proxy https://192.168.10.201/>
AllowOverride None
Order Deny,Allow
Allow from all
</proxy>
</VirtualHost>
总结
#Apache mod_proxy做反向代理
##要做更多支持请开启以下相应module
##proxy_module
##反向代理模块
##proxy_http_module
##反向代理http协议模块
##Rewrite_module
##地址重写
##ssl_module
##ssl协议模块
########################################################
# 通过https请求apache,apache也通过https访问系统
########################################################
Listen 443
<VirtualHost *:443>
ProxyRequests On
# 声明ssl代理引擎
SSLProxyEngine on
# 这里声明代理的URL转换处理
# 注意需要使用域名,否则证书、用户页面的URL会有问题
ProxyPass / https://www.×××.com/
ProxyPassReverse / https://www.×××.com/
#此处项目名称 /https://www.×××.com/ 代理为 / 跟目录访问,session会丢失,需要配置如下信息
ProxyPassReverseCookiePath /https://www.×××.com /
</VirtualHost>
#############################################################
# 通过http请求apache,apache也通过http访问代理站点
#############################################################
Listen 80
<VirtualHost *:80>
ProxyRequests On
ProxyPass / http://www.×××.com/
ProxyPassReverse / http://www.×××.com/
ProxyPassReverseCookiePath /https://www.×××.com /
<proxy https://www.×××.com>
AllowOverride None
Order Deny,Allow
Allow from all
</proxy>
</VirtualHost>
########################################################
# 通过http请求apache,apache通过https访问系统
########################################################
Listen 8002
<VirtualHost *:8002>
ProxyRequests On
# 声明ssl代理引擎
SSLProxyEngine on
# 这里声明代理的URL转换处理
# 注意需要使用域名,否则证书、用户页面的URL会有问题
ProxyPass / https://www.×××.com/
ProxyPassReverse / https://www.×××.com/
#此处项目名称 /https://www.×××.com/ 代理为 / 跟目录访问,session会丢失,需要配置如下信息
ProxyPassReverseCookiePath /https://www.×××.com /
<proxy https://www.×××.com>
AllowOverride None
Order Deny,Allow
Allow from all
</proxy>
</VirtualHost>

原文地址:https://www.cnblogs.com/js1314/p/9712783.html