问题描述
今天在配置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>