我正在尝试配置反向代理服务器(Centos 7)。虚拟主机配置如下:
<VirtualHost *:443>
ServerName www.example2.com
ServerAlias example2.com
ProxyPass / https://keycdn.com/
ProxyPassReverse / https://keycdn.com/
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
ErrorLog /var/log/httpd/example.com-error.log
CustomLog /var/log/httpd/example.com-access.log combined
</VirtualHost>
它总是重定向到实际的 URL,而不是作为反向代理工作,但对于 http 站点来说工作得很好:
ProxyPass / http://example.com/
ProxyPassReverse / http://example.com/
有谁能告诉我该怎么做才能使用 ProxyPass/ProxyPassReverse 实现 HTTPS。谢谢。
[编辑]
对于 https proxypass,它总是回复 301-Moved Permanently。
答案1
你可能遗漏了:
ProxyPreserveHost On