ever lis font all origin context 客户 att resp
在 / etc/httpd/conf/httpd.conf 增加一个转发模块 或者
在 / etc/httpd/conf.d / 中新建一个 jira.conf 的配置文件
ProxyPreserveHost On
ServerName jira.new.xxx.com
ProxyPass / http://122.x.x.x:8080/
ErrorLog logs/jira_error_log
CustomLog logs/jira_access_log common
apache 在 http 协议基础上使用 ProxyPass 转发 URL 到 tomcat,jira 上
ProxyPass 模块主要转发功能
/etc/httpd/modules / 路径下包含 mod_proxy.so 和 mop_proxy_http.so 两个模块就具备转发能力
支持 https 协议加密
yum -y install openssl 安装 openssl 提供 ssl 加密协议,执行命令 openssl version 查看 OpenSSL 的版本
mod_ssl.so 该模块负责将 http 协议加密成 https 协议
yum -y install mod_ssl 后,/etc/httpd/modules / 下会生成 mod_ssl.so 文件
然后配置 / etc/httpd/conf.d/ssl.conf 配置文件,配置 key 密钥
mod_rewrite.so 该模块负责实现客户端浏览器访问 http 时自动转成 https 协议
测试访问 192.168.1.10/examples 后,自动转发到 192.168.1.10:80/exaples 页面,http 协议转发跳转
ProxyPass /examples http://192.168.1.10:8080/examples/
ProxyPassReverse /examples http://192.168.1.10:8080/examples/
客户端 https 访问 https://192.168.1.10/docs,自动通过 http 协议转发到 192.168.1.10:8080/docs
/etc/httpd/conf/httpd.conf 配置文件中,添加 Include conf.d/*.conf 允许加载其他配置文件
编辑 / etc/httpd/conf.d/ssl.conf,使支持 https 协议
LoadModule ssl_module modules/mod_ssl.so
Listen 443
##
## SSL Virtual Host Context
##
## 监听该主机上所有 ip 的 443 端口
ErrorLog logs/ssl_error_log ## 错误日志路径
TransferLog logs/ssl_access_log ## 访问日志路径
LogLevel warn #日志登记
SSLEngine on ## 开启 ssl 加密
SSLProtocol all -SSLv2 ## 加密协议
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/localhost.crt ## 证书路径
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key ## 证书密钥路径
SSLOptions +StdEnvVars
SSLOptions +StdEnvVars
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
# 在 https 协议中实现 ProxyPass 转发 URL,实际就是在 ssl.conf 中添加 ProxyPass 语句
ProxyPass /test http://192.168.1.10:8080/examples ## 实现客户端访问 https://192.168.1.10/test,自动转发到 http://192.168.1.10/examples
ProxyPassReverse /test http://192.168.1.10:8080/examples
ProxyPass /docs http://192.168.1.10:8080/docs 注意,末尾没有 / 符号,http://192.168.1.10:8080/docs / 是错误的
ProxyPassReverse /docs http://192.168.1.10:8080/docs
实现 http 自动转换成 https 协议
为了让客户输入普通 http 地址时可以自动跳转到加密的 https 页面,并跳转到后端 tomcat 页面
在 / etc/httpd/conf/httpd.conf 的站点模块中,或者 conf.d / 的指定站点配置文件中配置
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteLog /var/log/httpd/rewrite.log
RewriteLogLevel 10
然后重启 httpd 服务
转载: https://www.cnblogs.com/dule/p/5849941.html
http://blog.csdn.net/pierre_/article/details/44980227
apache 配置转发到后端的 tomcat/jira
来源: http://www.bubuko.com/infodetail-2467069.html