問題描述
今天在配置apache虛擬地址時出現500錯誤,即綁定127.0.0.1的host后訪問配置好的虛擬地址,瀏覽器返回500 Internal Server Error
,打開apache的error.log查看錯誤日志,發現如下錯誤代碼和描述:
[ssl:warn] [pid 29276:tid 292] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
環境介紹
XAMPP,windows 7,火狐瀏覽器
解決方法
提示說服務器證書不包含與服務器名稱匹配的ID,ssl警告,試着以管理員身份運行XAMPP Control Panel,再在瀏覽器中輸入虛擬地址,回車,成功!
Tips
幾條關於apache配置的小建議:
1、使用notepad++打開httpd.conf和heepd-vhosts.conf文件,免得用一次要去找一次文件。
2、httpd.conf需要添加的語句主要有:
1 # 2 # Deny access to the entirety of your server's filesystem. You must 3 # explicitly permit access to web content directories in other 4 # <Directory> blocks below. 5 # 6 <Directory /> 7 AllowOverride ALL 8 Require all granted 9 Order Deny,Allow 10 Allow from all 11 </Directory>
3、在httpd-vhosts.conf中配置虛擬路徑,需要添加的內容參照如下語句:
1 <VirtualHost *:80> 2 DocumentRoot "E:/example/wwwroot" 3 ServerName example.com 4 </VirtualHost>
4、不要忘了在根目錄下添加.htaccess文件,如下語句可以隱藏index:
1 <IfModule mod_rewrite.c> 2 RewriteEngine on 3 RewriteCond %{REQUEST_FILENAME} !-d 4 RewriteCond %{REQUEST_FILENAME} !-f 5 RewriteRule ^(.*)$ /index.php/$1 [QSA,PT,L] 6 </IfModule>