Como configurar corretamente um Apache VirtualHost como HTTP e HTTPS?

Como configurar corretamente um Apache VirtualHost como HTTP e HTTPS?

Estou tentando configurar um site SSL localmente (para fins de desenvolvimento/teste) usando Apache e mod_ssl e é isso que tenho em meus arquivos VirtualHost:

/etc/httpd/conf.d/local.conf
<VirtualHost *:80>
    ServerName reptool.dev

    DocumentRoot /var/www/html/magnific/reptooln_admin/web
    <Directory /var/www/html/magnific/reptooln_admin/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

    ErrorLog /var/log/httpd/reptool-error.log
    CustomLog /var/log/httpd/reptool-access.log combined
</VirtualHost>

/etc/httpd/conf.d/local-ssl.conf
<VirtualHost reptool.dev:443>
    ServerName reptool.dev:443

    DocumentRoot /var/www/html/magnific/reptooln_admin/web
    <Directory /var/www/html/magnific/reptooln_admin/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

    ErrorLog /var/log/httpd/reptool-error.log
    CustomLog /var/log/httpd/reptool-access.log combined

    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/ca.crt
    SSLCertificateKeyFile /etc/pki/tls/private/ca.key
</VirtualHost>

O primeiro (o não-SSL) funciona bem, mas com o SSL não recebi o erro 404:

The requested URL /app_dev.php was not found on this server.

Por que? O que estou perdendo no nível de configuração?

Responder1

Seu nome de servidor "reptool.dev:443" não parece correto para mim, não deveria conter a porta. Tentar:

ServerName reptool.dev

informação relacionada