
我正在嘗試使用 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
您的伺服器名稱“reptool.dev:443”對我來說看起來不正確,它不應該包含連接埠。嘗試:
ServerName reptool.dev