Apache Web 服务器从 http 重定向到 https 错误

Apache Web 服务器从 http 重定向到 https 错误

我为我的 Apache Web 服务器设置了多主机,并运行 letsencrypt SSL。我主要托管 2 个应用程序,即 OpenProject 和 SugarCRM,但我认为这没什么关系。这是我的环境。

Centos 7-4.1708 64 Bit
Webserver: Apache Web Server 2.4
All running as VM in ESXI
OpenProject IP: 192.168.1.121
SugarCRM IP: 192.168.1.122
Gateway: 192.168.1.1

因此,每次我使用 https 登录 OpenProject 时,它都会接受用户名和密码,但随后会出现这个错误。

Bad Request.
Your browser sent a request that this server could not understand.  
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

我的配置设置如下。

<VirtualHost *:4000>
ServerName pm.server1.com
ServerAlias server1.com
ServerAdmin [email protected]
DocumentRoot /opt/openproject/public
ErrorLog /var/log/httpd/pm.server1.com-error_log
CustomLog /var/log/httpd/pm.server1.com-access_log common

<Directory /opt/openproject/public>
      Options +FollowSymLinks +Includes
      AllowOverride All
      Require all granted
   </Directory>

ProxyRequests off
ProxyPass / http://127.0.0.1:6000/ retry=0
ProxyPassReverse / http://127.0.0.1:6000/

SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/pm.server1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/pm.server1.com/privkey.pem
</VirtualHost>

<VirtualHost *:4001>
   ServerAdmin [email protected]
   ServerName sugar.server1.com
   ServerAlias server1.com
   DocumentRoot /opt/sugarcrm
   ErrorLog /var/log/httpd/sugar.server1.com-error_log
   CustomLog /var/log/httpd/sugar.server1.com-access_log common


<Directory /opt/sugarcrm>
      Options +FollowSymLinks +Includes
      AllowOverride All
      Require all granted
   </Directory>

SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/sugar.server1.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sugar.server1.com/privkey.pem
</VirtualHost>

我确信我在这个配置中遗漏了一些东西,而且我费了好几天劲才搞清楚我做错了什么。我相信这与错误的重定向配置有关。我现在非常沮丧,甚至到了写不出东西的地步。你们当中有谁,Apache Web 服务器大师,能与我分享一些如何修复 Apache 配置文件的内幕信息吗?非常感谢你们的所有帮助。

相关内容