【发布时间】:2019-02-11 15:43:12
【问题描述】:
我浏览了网络上所有类似的主题,但似乎找不到解决方案。
我已成功安装 Let's Encrypt 证书,但无法从 http 自动重定向到工作。重定向由 certbot(Letsencrypt 安装脚本)通过 /etc/apache2/sites-available/domain.com.conf 文件设置。这是文件的内容:
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /home/username/public_html/domain.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.domain.com [OR]
RewriteCond %{SERVER_NAME} =domain.com
RewriteCond %{THE_REQUEST} !/(robots.txt|sitemap.xml)\s [NC]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
该文件已正确链接到其启用站点的符号链接。我尝试重新加载/重新启动 apache2 服务,尝试禁用该网站的本地 .htaccess 文件,但都无济于事。我扫描了所有的 .conf 文件,并确保在任何其他 .conf 文件中都没有提到这个域。奇怪的是,重定向确实适用于我位于同一服务器上的一些网站,但对于某些网站则不起作用。
我尝试过查看日志文件,但没有找到任何具体内容。
请帮忙!
【问题讨论】:
-
443 端口服务器的配置是什么样的?