Configurei um vhost para um domínio na porta 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>
A visita ao site resulta em:
Pedido ruim
Seu navegador enviou uma solicitação que este servidor não conseguiu entender. Motivo: Você está falando HTTP simples para uma porta de servidor com SSL habilitado. Em vez disso, use o esquema HTTPS para acessar esta URL, por favor. Servidor Apache/2.4.58 (Ubuntu) em 127.0.1.1 Porta 80
Desabilitei todas as outras permutações de vhost https http, www e sem www.
Verifiquei o seguinte (não tenho certeza do que fazer com o seguinte):
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)
e verifiquei outros vhosts.
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#
outras informações para análise:
root@server03:/etc/apache2/sites-available# cat drupalsolent.dev.conf
<VirtualHost *:80>
ServerName drupalsolent.dev
RedirectPermanent / https://drupalsolent.dev/
</VirtualHost>
Tentei o domínio em diferentes redes: fixa e móvel, o mesmo erro, então acho que deve ser algo no servidor.
O que poderia ser?
Preciso resolver esse problema porque me conecto na porta 80 para que o LetsEncrypt forneça um certificado https.
Obrigado pela ajuda.
Eu dei uma olhada em Servir a porta 443 por http cria o erro 400 Bad Request em vez de redirecionar, que tem algumas semelhanças, mas não é bem o que estou procurando.
Resolvido. Possível configuração incorreta de outros arquivos conf do vhost
Parece que isso está resolvido.
http://thesolentmetropolitan.com e http://thesolentmetropolitan.com:80 agora se comportam como esperado - ambos redirecionam para https://thesolentmetropolitan.com - e posso renovar este domínio e também https://internationalgospelchoir.uk e https://www.internationalgospelchoir.uk .
O que fiz foi desabilitar todos os outros arquivos vhost .conf, como mostra meu log de terminal.
Acho que sua contribuição @vidarlo: Por que o Apache está escutando na porta 80 do servidor com SSL habilitado? ajudou a considerar a necessidade de considerar os outros arquivos de configuração.
Parece-me que copiar e colar de um arquivo vhost deixou o domínio original lá e não o atualizou com o domínio correto. Por exemplo, estou pensando se fiz uma cópia do arquivo drupalsolent.dev.conf para o arquivo thesolentmetropolitan.com.conf e deixei o domínio drupalsolent.dev lá, ou algo assim. Acho que o problema é algo assim, onde um copiar e colar deu errado.
Vou analisar isso mais a fundo. Por enquanto, parece que não preciso construir outro servidor.
Tentarei investigar a causa raiz mais específica.
Referência: https://community.letsencrypt.org/t/how-to-re-create-cert-i-just-have-standard-apache-vhost-config-files-for-port-80-443/235394 para discussão relacionada sobre a tentativa de renovar https.