conf文件HTTP重定向到https

conf文件HTTP重定向到https

本文介绍了通过配置Apache的.conf文件HTTP重定向到https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须通过配置code阿帕奇Tomcat的配置如

I have configure apache to tomcat configuration by code like

<VirtualHost *:80>
ServerName captiveportal
ProxyPass       / http://ip:port/path
ProxyPassReverse / http://ip:port/path
</VirtualHost>

现在我想reirect这个请求到https
我怎样才能做到这一点?

Now i want to reirect this request to httpsHow can i achieve this ?

找你的答案后,我已经改变了我的配置如

After looking your answer i have changes my configuration like

<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/httpd/conf/crt1.crt"
SSLCertificateKeyFile "/etc/httpd/conf/key1.key"
ProxyPass       / http://ip:port/path
</VirtualHost>
<VirtualHost *:80>
ServerName captiveportal
Redirect / https://ip:port/path
</VirtualHost>

但是当我键入 captiveportal 在我的浏览器,它重定向我的网址的https:// IP:端口/路径并显示问题载入页面

but when i type captiveportal on my browser it redirects me on url https://ip:port/path and it displays problem loading page

还有一件事,我不希望显示的https:// IP:端口/路径上的浏览器

One more thing i don't want to display https://ip:port/path on browser.

请注意: - 的https:// IP:端口/路径其中port是我的tomcat的端口和IP是机器的IP,其中的Tomcat运行

Note :- https://ip:port/path where port is my tomcat port and ip is machine ip where tomcat run.

推荐答案

您可以做这样的事情:

<VirtualHost *:80>
   ServerName captiveportal
   Redirect / https://my.host.name/
</VirtualHost>

...然后把你的的ProxyPass 指令侧的SSL 虚拟主机块来代替。

...and then put your ProxyPass directives in side your SSL VirtualHost block instead.

这篇关于通过配置Apache的.conf文件HTTP重定向到https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 05:23