我已经为端口 80 的域设置了一个虚拟主机:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName thesolentmetropolitan.com
DocumentRoot /var/www/10/thesolentmetropolitan.com/deployment_environments/live/docroot
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/thesolentmetropolitan.com/docroot">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>
访问该网站的结果是:
错误的请求
您的浏览器发送了一个此服务器无法理解的请求。原因:您正在向启用 SSL 的服务器端口发送纯 HTTP 消息。请使用 HTTPS 方案访问此 URL。Apache/2.4.58 (Ubuntu) 服务器位于127.0.1.1 端口 80
我禁用了所有其他 vhost 排列 https http、www 和不带 www。
我检查了以下内容(我不确定如何处理以下内容):
sudo lsof -i -n | grep https
apache2 520640 root 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520645 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520662 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520705 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520706 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520707 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520708 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520741 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520743 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520981 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
apache2 520982 www-data 6u IPv6 4829014 0t0 TCP *:https (LISTEN)
并检查了其他虚拟主机。
root@server03:/etc/apache2/sites-available# apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443 is a NameVirtualHost
default server drupalsolent.dev (/etc/apache2/sites-enabled/drupalsolent.dev-le-ssl.conf:2)
port 443 namevhost drupalsolent.dev (/etc/apache2/sites-enabled/drupalsolent.dev-le-ssl.conf:2)
port 443 namevhost www.drupalsolent.dev (/etc/apache2/sites-enabled/drupalsolent.dev-le-ssl.conf:21)
port 443 namevhost eval1.labs.drupalsolent.dev (/etc/apache2/sites-enabled/eval1.labs.drupalsolent.dev-le-ssl.conf:2)
port 443 namevhost internationalgospelchoir.uk (/etc/apache2/sites-enabled/internationalgospelchoir.uk-le-ssl.conf:2)
port 443 namevhost staging.internationalgospelchoir.uk (/etc/apache2/sites-enabled/staging.internationalgospelchoir.uk-le-ssl.conf:2)
port 443 namevhost www.internationalgospelchoir.uk (/etc/apache2/sites-enabled/www.internationalgospelchoir.uk-le-ssl.conf:2)
*:80 is a NameVirtualHost
default server drupalsolent.dev (/etc/apache2/sites-enabled/drupalsolent.dev.conf:1)
port 80 namevhost drupalsolent.dev (/etc/apache2/sites-enabled/drupalsolent.dev.conf:1)
port 80 namevhost eval1.labs.drupalsolent.dev (/etc/apache2/sites-enabled/eval1.labs.drupalsolent.dev.conf:1)
port 80 namevhost internationalgospelchoir.uk (/etc/apache2/sites-enabled/internationalgospelchoir.uk.conf:1)
port 80 namevhost staging.internationalgospelchoir.uk (/etc/apache2/sites-enabled/staging.internationalgospelchoir.uk.conf:1)
port 80 namevhost thesolentmetropolitan.com (/etc/apache2/sites-enabled/thesolentmetropolitan.com.conf:1)
port 80 namevhost www.drupalsolent.dev (/etc/apache2/sites-enabled/www.drupalsolent.dev.conf:1)
port 80 namevhost www.internationalgospelchoir.uk (/etc/apache2/sites-enabled/www.internationalgospelchoir.uk.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
root@server03:/etc/apache2/sites-available#
其他分析信息:
root@server03:/etc/apache2/sites-available# cat drupalsolent.dev.conf
<VirtualHost *:80>
ServerName drupalsolent.dev
RedirectPermanent / https://drupalsolent.dev/
</VirtualHost>
我已经在不同网络上尝试过该域名:固定电话和移动电话,都出现了同样的错误,所以我想这一定是服务器上的问题。
会是什么呢?
我需要解决这个问题,因为我连接到端口 80 以便 LetsEncrypt 提供 https 证书。
感谢您的帮助。
我查看了通过 http 服务端口 443 会产生 400 错误请求错误而不是重定向,它确实有一些相似之处,但不是我想要的。