需求场景:通过访问apache的http地址,反向代理访问后端的https服务,而且路径带有只能特定模块才反向代理

配置如下

 listen 

 <VirtualHost *:>
#管理员邮箱 随便填 可不要此指令
ServerAdmin webmaster@dummy-host.example.com
#域名 为IP地址
ServerName 本机ip <Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine On #https代理最关键就是这个
ProxyPreserveHost On
ProxyRequests Off #关闭正向代理
#ProxyPassMatch ^/foo/bar https://123.123.123.2 #443端口这么写
ProxyPassMatch ^/foo/bar https://123.123.123.2:6079(如果是443端口不要加了,否则连接不上,可以打开httpd.conf 打开debug级别日志能看到)
ProxyPass / ! #表示不是上面匹配的路径不转发,走默认的httpd.conf DocumentRoot
ProxyPassReverse / ! #表示不是上面匹配的路径不转发,走默认的httpd.conf DocumentRoot
ErrorLog /var/log/httpd/test_error_log
CustomLog /var/log/httpd/test_access_log combined
</VirtualHost

效果展示

curl http://本地ip:8182/foo/bar/123

会转发到后端

示范日志,需要httpd开启debug 在httpd.conf 修日志级别重启l即可

[Thu Sep  ::27.575036 ] [authz_core:debug] [pid ] mod_authz_core.c(): [client 192.168.10.30:] AH01628: authorization result: granted (no directives)
[Thu Sep ::27.575188 ] [proxy:debug] [pid ] mod_proxy.c(): [client 192.168.10.30:] AH01143: Running scheme https handler (attempt )
[Thu Sep ::27.575197 ] [proxy_ajp:debug] [pid ] mod_proxy_ajp.c(): [client 192.168.10.30:] AH00894: declining URL https://123.123.123.2/foo/bar/getFPInfoByNSRSBH
[Thu Sep ::27.575203 ] [proxy_fcgi:debug] [pid ] mod_proxy_fcgi.c(): [client 192.168.10.30:] AH01076: url: https://123.123.123.2/foo/bar/getFPInfoByNSRSBH proxyname: (null) proxyport: 0
[Thu Sep ::27.575207 ] [proxy_fcgi:debug] [pid ] mod_proxy_fcgi.c(): [client 192.168.10.30:] AH01077: declining URL https://123.123.123.2/foo/bar/getFPInfoByNSRSBH
[Thu Sep ::27.575221 ] [proxy:debug] [pid ] proxy_util.c(): AH00942: HTTPS: has acquired connection for (123.123.123.2)
[Thu Sep ::27.575229 ] [proxy:debug] [pid ] proxy_util.c(): [client 192.168.10.30:] AH00944: connecting https://123.123.123.2/foo/bar/getFPInfoByNSRSBH to 123.123.123.2:443
[Thu Sep ::27.575321 ] [proxy:debug] [pid ] proxy_util.c(): [client 192.168.10.30:] AH00947: connected /foo/bar/getFPInfoByNSRSBH to 123.123.123.2:
[Thu Sep ::27.581116 ] [proxy:debug] [pid ] proxy_util.c(): AH02824: HTTPS: connection established with 123.123.123.2: (123.123.123.2)
[Thu Sep ::27.581151 ] [proxy:debug] [pid ] proxy_util.c(): AH00962: HTTPS: connection complete to 123.123.123.2: (123.123.123.2)
[Thu Sep ::27.581161 ] [ssl:info] [pid ] [remote 123.123.123.2:] AH01964: Connection to child established (server 192.168.10.30:)
[Thu Sep ::27.598908 ] [ssl:debug] [pid ] ssl_engine_kernel.c(): [remote 123.123.123.2:] AH02275: Certificate Verification, depth , CRL checking mode: none [subject: CN=Encryption Everywhere DV TLS CA - G1,OU=www.digicert.com,O=DigiCert Inc,C=US / issuer: CN=DigiCert Global Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US / serial: 0279AC458BC1B245ABF98053CD2C9BB1 / notbefore: Nov :: GMT / notafter: Nov :: GMT]
[Thu Sep ::27.599201 ] [ssl:debug] [pid ] ssl_engine_kernel.c(): [remote 123.123.123.2:] AH02275: Certificate Verification, depth , CRL checking mode: none [subject: CN=*.ele-cloud.com / issuer: CN=Encryption Everywhere DV TLS CA - G1,OU=www.digicert.com,O=DigiCert Inc,C=US / serial: 01B4CA2CA4522D242C3055C4C5920F94 / notbefore: Aug :: GMT / notafter: Aug :: GMT]
[Thu Sep ::27.610271 ] [ssl:debug] [pid ] ssl_engine_kernel.c(): [remote 123.123.123.2:] AH02041: Protocol: TLSv1., Cipher: ECDHE-RSA-AES128-SHA256 (/ bits)
[Thu Sep ::27.760324 ] [proxy:debug] [pid ] proxy_util.c(): AH00925: initializing worker https://123.123.123.2 shared
[Thu Sep ::27.760336 ] [proxy:debug] [pid ] proxy_util.c(): AH00927: initializing worker https://123.123.123.2 local
[Thu Sep ::27.760353 ] [proxy:debug] [pid ] proxy_util.c(): AH00931: initialized single connection worker in child for (123.123.123.2)
[Thu Sep ::28.238290 ] [proxy:debug] [pid ] proxy_util.c(): AH00943: https: has released connection for (123.123.123.2)

顺便记录反向代理http

[root@oc conf.d]# vim vhost.conf

listen 

<VirtualHost *:>

    #管理员邮箱

    ServerAdmin webmaster@dummy-host.example.com

    #域名

    ServerName 本机ip

    <Proxy *>

        Order deny,allow

        Allow from all

    </Proxy>

    ProxyPreserveHost On

    ProxyRequests Off #关闭正向代理

    ProxyPassMatch ^/recipt/checkFp http://123.48.78.9:8080 #默认端口80,不需要填端口

    ProxyPass / !

    ProxyPassReverse / !

    ErrorLog /var/log/httpd/test_error_log

    CustomLog /var/log/httpd/test_access_log combined

</VirtualHost>

反向代理不过滤path

[root@oc conf.d]# vim vhost.conf
listen <VirtualHost *:>
#管理员邮箱
ServerAdmin webmaster@dummy-host.example.com
#域名
ServerName 本机ip <Proxy *>
Order deny,allow
Allow from all
</Proxy> ProxyPreserveHost On
ProxyRequests Off #关闭正向代理 ProxyPass / http://123.48.78.9:8080
ProxyPassReverse / http://123.48.78.9:8080
ErrorLog /var/log/httpd/test_error_log
CustomLog /var/log/httpd/test_access_log combined
</VirtualHost>

apache 2.4 httpd 2.4.6 反向代理后端的服务为HTTPS https 基于centos7的更多相关文章

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

    在/etc/httpd/conf路径下的httpd.conf文件###new add for webui.cong###Include "E:/local/Wamp/bin/apache/A ...

  2. tomcat部署虚拟主机-搭建两个应用以及httpd和Nginx的反向代理

    实验环境:CentOS7 前提:已经安装好tomcat,未安装请查看http://www.cnblogs.com/wzhuo/p/7111135.html: 目的:基于主机名访问两个应用: [root ...

  3. Nginx反向代理+负载均衡简单实现(https方式)

    背景:A服务器(192.168.1.8)作为nginx代理服务器B服务器(192.168.1.150)作为后端真实服务器 现在需要访问https://testwww.huanqiu.com请求时从A服 ...

  4. Nginx负载均衡反向代理 后端Nginx获取客户端真实IP

    Nginx 反向代理后,后端Nginx服务器无法正常获取客户端的真实IP nginx通过http_realip_module模块来实现的这需要重新编译,如果提前编译好了就无需重新编译了1,重新编译ng ...

  5. 十.nginx反向代理负载均衡服务实践部署

    期中集群架构-第十章-nginx反向代理负载均衡章节章节====================================================================== 0 ...

  6. haproxy反向代理环境部署(http和https代理)

    操作背景:前方有一台haproxy代理机器(115.100.120.57/192.168.1.7),后方两台realserver机器(192.168.1.150.192.168.1.151,没有公网i ...

  7. nginx设置反向代理后端jenklins,页面上的js css文件无法加载

    转载 2017年06月14日 22:36:59 8485 问题现象: nginx配置反向代理后,网页可以正常访问,但是页面上的js css文件无法加载,页面样式乱了. (1)nginx配置如下: (2 ...

  8. nginx反向代理-后端服务器组设置

    nginx服务器的反向代理时其最常用的重要功能之一,在实际工作中应用广泛,涉及的配置指令也比较多.下面会尽量详细地介绍对应的指令,及其使用状态. 反向代理一般是互联网需要向内网拉取资源,比如访问一个w ...

  9. Linux基础-----------nginx安装和nginx web、nginx反向代理、nfs 服务

    作业一:nginx服务1)二进制安装nginx包 yum install epel-release -y 先安装epel-release 再查看yum源中已经安装上了epel相关文件 中间省去了一些安 ...

随机推荐

  1. B. Sleepy Game 博弈搜索

    题意:给一个有向图和起点,然后只有一名选手,这名选手可以随意挪动棋子,最终不能动的时候走过的边为奇数边为Win并输出路径,否则如果有环输出Draw,否则输出Lose; 题目链接 知道状态数最多只有n* ...

  2. 【Java_Eclipse】Eclipse插件如何卸载?

    本博客我们讲一下对于Eclipse的插件卸载 1.Eclipse中:Window——Install  New  SoftWare 2.找到相应插件卸载即可

  3. SpringBoot整合SpringSecurity实现JWT认证

    目录 前言 目录 1.创建SpringBoot工程 2.导入SpringSecurity与JWT的相关依赖 3.定义SpringSecurity需要的基础处理类 4. 构建JWT token工具类 5 ...

  4. MySQL常用控制台指令

    MySQL服务的启用与停止 MySQL服务的启用: net start mysql80 MySQL服务的停止: net stop mysql80 MySQL的登入与退出 数据库的登入: mysql - ...

  5. eatwhatApp开发实战(一)

    开发背景: 当你想用抛硬币来决定事情的时候,那么硬币抛起的瞬间,你就有答案了.一样的,吃啥?eatwhat点开,按钮一点,你就可以知道你中午要吃啥. 话不多说,项目开发走起 ADT点开,New==&g ...

  6. [JavaWeb基础] 020.Velocity 模板引擎简单示例

    1.什么是Velocity 一种J2EE的前端模版技术,和JSP,Freemarker差不多,都是用来展示网页内容的.和JSP不同的是velocity只能显示Action中的数据,不能处理数据.不能写 ...

  7. RxJS 中的创建操作符

    RxJs 中创建操作符是创建数据流的起点,这些操作符可以凭空创建一个流或者是根据其它数据形式创建一个流. Observable的构造函数可以直接创建一个数据流,比如: const $source=ne ...

  8. sqlmap tamper脚本备忘录与tamper脚本编写

    查看sqlmap全部脚本 $ python sqlmap.py --list-tampers 使用方法 --tamper=TAMPER 2019.9更新后翻译 * apostrophemask.py- ...

  9. Shellshock漏洞复现

    漏洞分析: exp: curl -A "() { :; }; echo; /bin/cat /etc/passwd" http://172.16.20.134:8080/victi ...

  10. 树莓派3B安装ubuntu mate系统后无法联网

    问题描述:在安装系统的初始化操作时,可以联网,如下图所示: 但是在系统安装结束后,wifi标志处无信号,无法搜索wifi信号. 解决方法:实测有效 直接打开终端(ctrl+alt+t),执行指令:su ...