Apache VirtualHost를 HTTP 및 HTTPS로 올바르게 설정하는 방법은 무엇입니까?

Apache VirtualHost를 HTTP 및 HTTPS로 올바르게 설정하는 방법은 무엇입니까?

Apache 및 mod_ssl을 사용하여 로컬(개발/테스트 목적) 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

관련 정보