(抱歉我的英语不好)嗨,我知道这不是关于重定向到代理服务器中的安全连接的第一个问题,但我不知道如何解决它。
这是我的配置
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLProxyEngine on
SSLProxyCheckPeerCN Off
SSLCertificateFile /etc/ssl/certs/certificado.pem
SSLProtocol -all +TLSv1.2
<VirtualHost *:80 *:443>
Redirect permanent / https://dev.domain.com/
ServerName domain.com
serveralias dev.domain.com
ProxyPass /workflow http://172.16.1.105/workflow
ProxyPassReverse /workflow http://172.16.1.105/workflow
ProxyPass /redmine http://172.16.1.109/redmine
ProxyPassReverse /redmine http://172.16.1.109/redmine
ProxyPass /SucursalVirtual http://172.16.1.105/SucursalVirtual
ProxyPassReverse /SucursalVirtual http://172.16.1.105/sucursalvirtual
ProxyPass /WebCliente http://172.16.1.105/WebCliente
ProxyPassReverse /WebCliente http://172.16.1.105/WebCliente
</virtualhost>
<virtualhost *:443 *:80>
Redirect permanent / https://devbi.domain.com/
ServerName domain.com
serveralias devbi.domain.com
ProxyPass /app/ wss://172.16.0.252:443/app/ retry=0
ProxyPassReverse /app/ wss://172.16.0.252:443/app/ retry=0
ProxyPass /hub/qrsData wss://172.16.0.252:443/hub/qrsData retry=1 acquire=300 timeout=600 Keepalive=On
ProxyPassReverse /hub/qrsData wss://172.16.0.252:443/hub/qrsData
ProxyPass /windows_authentication/ https://172.16.0.252:4244/windows_authentication/ retry=1 acquire=300 timeout=600 Keepalive=On
ProxyPassReverse /windows_authentication/ https://172.16.0.252:4244/windows_authentication/
ProxyPass / https://172.16.0.252/ retry=1 acquire=300 timeout=600 Keepalive=On
ProxyPassReverse / https://172.16.0.252/
</virtualhost>
<Directory /var/www>
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory /usr/local/apache2/htdocs>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
但如果重定向例如来自http://google.com到https://google.com或其他网页都可以!如果将我自己的 *.domain.com 重定向到 https 则不起作用
我没有 .htaccess 文件,并且我的 apache2.conf 是干净的(没有编辑)
答案1
例如,您可以尝试使用以下命令编辑虚拟主机:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.com
SSLProxyEngine On
RequestHeader set Front-End-Https "On"
CacheDisable *
ProxyPass /myapp https://ip:port/myapp
ProxyPassReverse /myapp https://ip:port/myapp
RedirectMatch ^/$ http://example.com/myapp
</VirtualHost>
答案2
我通常会做这样的事情:
<VirtualHost *:80>
ServerName www.example.com
ServerAlias www.example.com
ServerAdmin [email protected]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RedirectPermanent / https://www.example.com
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias www.example.com
ServerAdmin [email protected]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DocumentRoot /var/www/example
<Directory /var/www/example>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
SSLEngine on
SSLCertificateFile /certs/fullchain
SSLCertificateKeyFile /certs/privkey
</VirtualHost>
当然,请确保您已经启用了mod_ssl
和 您的虚拟主机 (分别是a2enmod ssl
和a2ensite <virtualhost.conf>
)。