Atualmente, estou seguindo o seguinte guia:
A instalação até agora está livre de problemas. Estou usando dois certificados de classe 1 que registrei no link . Cada um é mapeado para seu próprio domínio (correto).
O problema é este: ir para qualquer domínio sob https resolve para o mesmo documento raiz, ou seja, se eu vou para link , eu corretamente venha para a raiz do doc indicada em sua configuração do VirtualHost. No entanto, se eu acessar o link , serei enviado para a raiz de backend.domain2, permanecendo o URL intacto, com um aviso de que o certificado SSL é inválido. Uma inspeção do certificado "inválido" revela que é aquele conectado ao backend.domain2.
O que estou fazendo de errado aqui? as configurações do VirtualHost para os dois domínios estão abaixo:
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName mail.domain1.se
ServerAdmin [email protected]
ServerAlias www.mail.domain1.se
DocumentRoot /usr/share/apache2/roundcubemail
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /etc/ssl/certs/domain1.crt
SSLCertificateKeyFile /etc/ssl/private/domain1.key
#SSLCertificateChainFile /etc/ssl/certs/sub.class1.server.ca.pem
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
#Alias /mail "/usr/share/apache2/roundcubemail/"
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/apache2/roundcubemail/$1
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName backend.domain2.com
ServerAdmin [email protected]
#ServerAlias www.domain2.com
DocumentRoot /var/www/backend.domain2.com/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
#Alias /mail "/usr/share/apache2/roundcubemail/"
#ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/pegasusgbg.se/html/$1
SSLEngine On
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /etc/ssl/certs/domain2.crt
SSLCertificateKeyFile /etc/ssl/private/domain2.key
#SSLCertificateChainFile /etc/ssl/certs/sub.class1.server.ca.pem
CustomLog /var/log/apache2/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
</IfModule>
Minha configuração do ports.conf é:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
NameVirtualHost *:80
NameVirtualHost *:443
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet