(Apache)将https域重定向到端口服务抛出https

时间:2020-03-26 05:57:04

标签: https apache2 http-redirect

我之前已经在apache中完成了重定向,但是以一种简单的方式,我要做的是在apache服务器中启用重写模块,然后将两个 .conf 文件添加到<

下面提到的strong> / etc / apache2 / sites-available

以下文件用于将HTTP请求接收的throw域重定向到特定端口。

<VirtualHost *:80>
ServerAdmin me@mydomain.com
ServerName test.domain.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
    Order allow,deny
    Allow from all
</Proxy>
ProxyPass / https://localhost:3235/
ProxyPassReverse / https://localhost:3235/
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_NAME} =chat-dev.motivone.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

以下文件用于将HTTPS请求接收的throw域重定向到特定端口。

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin me@mydomain.com
ServerName test.domain.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
    Order allow,deny
    Allow from all
</Proxy>
ProxyPass / https://localhost:3235/
ProxyPassReverse / https://localhost:3235/
SSLCertificateFile /etc/letsencrypt/live/test.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

当我运行我的服务器抛出HTTP并将代理更改为HTTP,但是当我在https上运行我的服务器然后尝试重定向它时,此过程运行良好。它会抛出

之类的错误

enter image description here

我不确定出什么毛病了,谢谢您的帮助,

0 个答案:

没有答案