Protocol http servi sur port 443
Bonjour,
lorsque j'accède à http://mysite.com:443 j'obtiens la page par défaut. Voici le vhost par défaut:
et le vhost du site posant problème (généré par letsencrypt):
Je ne comprends pas comment le protocol http est servi sur le port 443
Merci d'avance pour votre aide
Configuration: Apache 2.4 / Debian 9
lorsque j'accède à http://mysite.com:443 j'obtiens la page par défaut. Voici le vhost par défaut:
<bold>ks307144 ~ > cat /etc/apache2/sites-enabled/default-ssl.conf </bold>
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
et le vhost du site posant problème (généré par letsencrypt):
<bold>ks307144 sites-enabled > cat mysite.com.vhost-le-ssl.conf </bold>
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/clients/client1/web16/web
ServerName mysite.com
ServerAlias www.mysite.com
ServerAlias mail.mysite.com
ServerAdmin webmaster@mysite.com
ErrorLog /var/log/ispconfig/httpd/mysite.com/error.log
CustomLog /var/log/ispconfig/httpd/mysite.com/access.log combined
Alias /error/ "/var/www/mysite.com/web/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html
<IfModule mod_ssl.c>
</IfModule>
<Directory /var/www/mysite.com/web>
# Clear PHP settings of this website
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
Options +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/clients/client1/web16/web>
# Clear PHP settings of this website
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
Options +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# suexec enabled
<IfModule mod_suexec.c>
SuexecUserGroup web16 client1
</IfModule>
<IfModule mod_fastcgi.c>
<Directory /var/www/clients/client1/web16/cgi-bin>
Require all granted
</Directory>
<Directory /var/www/mysite.com/web>
<FilesMatch "\.php[345]?$">
SetHandler php-fcgi
</FilesMatch>
</Directory>
<Directory /var/www/clients/client1/web16/web>
<FilesMatch "\.php[345]?$">
SetHandler php-fcgi
</FilesMatch>
</Directory>
Action php-fcgi /php-fcgi virtual
Alias /php-fcgi /var/www/clients/client1/web16/cgi-bin/php-fcgi-*-80-mysite.com
FastCgiExternalServer /var/www/clients/client1/web16/cgi-bin/php-fcgi-*-80-mysite.com -idle-timeout 300 -socket /var/lib/php7.0-fpm/web16.sock -pass-header Authorization -pass-header Content-Type
</IfModule>
<IfModule mod_proxy_fcgi.c>
#ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix:///var/lib/php7.0-fpm/web16.sock|fcgi://localhost//var/www/clients/client1/web16/web/$1
<Directory /var/www/clients/client1/web16/web>
<FilesMatch "\.php[345]?$">
SetHandler "proxy:unix:/var/lib/php7.0-fpm/web16.sock|fcgi://localhost"
</FilesMatch>
</Directory>
</IfModule>
<IfModule mpm_itk_module>
AssignUserId web16 client1
</IfModule>
<IfModule mod_dav_fs.c>
# Do not execute PHP files in webdav directory
<Directory /var/www/clients/client1/web16/webdav>
<ifModule mod_security2.c>
SecRuleRemoveById 960015
SecRuleRemoveById 960032
</ifModule>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler None
</FilesMatch>
</Directory>
DavLockDB /var/www/clients/client1/web16/tmp/DavLock
# DO NOT REMOVE THE COMMENTS!
# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
# WEBDAV BEGIN
# WEBDAV END
</IfModule>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.mysite.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mysite.com/privkey.pem
</VirtualHost>
</IfModule>
Je ne comprends pas comment le protocol http est servi sur le port 443
Merci d'avance pour votre aide
1 réponse
-
Bonjour,
Normalementcertbot
s'occupe de générer le vhost pour toi. Voici comment je l'ai installé de mon côté (tout en root ou précédé desudo
)
1) Installation d'apache
sudo apt update
sudo apt install apache2 default-mysql-server libapache2-mod-php
2) Activer SSL
a2enmod ssl
service apache2 restart
3) Installer Let's Encrypt / certbot :
apt update
apt install certbot python-certbot-apache
4) Lancer certbot :
certbot --apache
(choisir le vhost http à passer en https)
5) Tester (en admettant que le site soit https://www.toto.com) :
https://www.ssllabs.com/ssltest/analyze.html?d=www.toto.com
6) Activer le renouvellement automatique du certificat :
certbot renew --dry-run
7) Si tout va bien :
certbot renew --quiet
Bonne chance