![apache https 端口 80 重定向到错误的 https 站点](https://linux22.com/image/723536/apache%20https%20%E7%AB%AF%E5%8F%A3%2080%20%E9%87%8D%E5%AE%9A%E5%90%91%E5%88%B0%E9%94%99%E8%AF%AF%E7%9A%84%20https%20%E7%AB%99%E7%82%B9.png)
当我在 /etc/apache2/sites-available/majichook.com.conf 中监听端口 80 并执行永久重定向到https://majichook.com由于某种原因,它转发给我的https://99centbeats.com相反。文件中的所有内容看起来都正确。我非常困惑...我在这个服务器上有其他带有 SSL 证书的域,它们使用完全相同的设置转发正常。
majichook.com.conf:
<VirtualHost *:80>
ServerName majichook.com
Redirect permanent / https://majichook.com/
</VirtualHost>
<VirtualHost *:443>
ServerName majichook.com
ServerAlias www.majichook.com
SSLEngine On
SSLCertificateFile /var/www/majichook.com/majichook_com.crt
SSLCertificateKeyFile /var/www/majichook.com/majichook.com.key
SSLCACertificateFile /var/www/majichook.com/majichook_com.ca-bundle
ServerAdmin [email protected]
DocumentRoot /var/www/majichook.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
答案1
重新配置 Apache 时
始终清除浏览器的缓存
答案2
感谢@Gerard H. Pille 建议我清除浏览器缓存,正是缓存导致了这个问题!现在一切正常!