我有一个 apache2 conf 文件,它应该代理到内部主机。出于某种原因,它在所有情况下都有效,但有一种情况除外。我有一个默认网站设置,它充当默认站点。此默认站点具有专用 SSL 证书。当路由出错时,我会收到安全错误,因为到正确主机的路由不正确,它会返回到默认主机。
这是我为虚拟主机设置的配置。
<VirtualHost www.example.co.uk:80>
ServerName www.example.co.uk
Redirect permanent / https://example.co.uk/
</VirtualHost>
<VirtualHost example.co.uk:80>
ServerName example.co.uk
Redirect permanent / https://example.co.uk/
</VirtualHost>
<VirtualHost www.example.co.uk:443>
ServerName www.example.co.uk
Redirect permanent / https://example.co.uk/
</VirtualHost>
<VirtualHost example.co.uk:443>
ServerName example.co.uk
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.co.uk/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.co.uk/fullchain.pem
SSLCACertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
ProxyPreserveHost On
ProxyPass / http://192.168.122.122:8080/
ProxyPassReverse / http://192.168.122.122:8080/
</VirtualHost>
可行的路线:
不起作用的路线:
据我所知,所有路由都是正确的,应该可以正常引导。我还尝试了 :443 虚拟主机的变化,以不包含“http”。任何建议都将不胜感激。
编辑
根据建议,我修改了 www.example.co.uk:443 主机以包含与 SSL 相同的内容:
<VirtualHost www.example.co.uk:443>
ServerName www.example.co.uk
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.co.uk/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.co.uk/fullchain.pem
SSLCACertificateFile /etc/letsencrypt/live/example.co.uk/cert.pem
ProxyPreserveHost On
ProxyPass / http://192.168.122.122:8080/
ProxyPassReverse / http://192.168.122.122:8080/
</VirtualHost>
还是没有运气
答案1
看起来您的www.example.co.uk:443
虚拟主机没有启用 SSL,也没有加载您的证书、密钥和信任链。