Как правильно настроить Apache VirtualHost для HTTP и HTTPS?

Как правильно настроить Apache VirtualHost для HTTP и HTTPS?

Я пытаюсь настроить локальный (в целях разработки/тестирования) сайт SSL с использованием Apache и mod_ssl, и вот что у меня в файлах 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>

Первый вариант (без SSL) работает нормально, а вот с SSL я получил ошибку 404:

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

Почему? Чего мне не хватает на уровне конфигурации?

решение1

Мне кажется, что ваш ServerName "reptool.dev:443" не подходит, в нем не должно быть порта. Попробуйте:

ServerName reptool.dev

Связанный контент