情况说明:服务器开通了虚拟主机,且已配置SSL,使用IP可以直接访问网站 现在通过配置使得只能通过域名来访问网站
具体方法:在httpd-vhosts.conf(对应的虚拟主机配置文件)的配置文件中增加以下内容
<Virtualhost *:80>
ServerName XXX.XXX.XXX.XXX #XXX.XXX.XXX.XXX为服务器IP地址
<Directory />
Order Allow,Deny
Deny from all
</Directory>
</Virtualhost>
<Virtualhost *:443>
ServerName XXX.XXX.XXX.XXX #XXX.XXX.XXX.XXX为服务器IP地址
<Directory />
Order Allow,Deny
Deny from all
</Directory>
</Virtualhost>
#================以上插入至原配置前===============
#=============以下为原配置内容,仅供参考==============
<VirtualHost *:80>
DocumentRoot "/***/wwwroot/"
ServerName www.log-ing.com
ServerAlias log-ing.com...
<Directory "/***/wwwroot/">
...
Order allow,deny
Allow from all
...
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/***/wwwroot/"
ServerName www.log-ing.com
ServerAlias log-ing.com
SSLEngine on
SSLCertificateFile "***.pem"
SSLCertificateKeyFile "***.key"
...
<Directory "/***/wwwroot/">
...
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Views: 867