https服務器的配置(二)配置apache虛擬主機

一、配置httpd.conf文件

開啓vhost模塊

包含對應的文件

[root@CentOS6 bin]# vim/etc/httpd/httpd.conf

 

LoadModule vhost_alias_modulemodules/mod_vhost_alias.so

 

Include /etc/httpd/extra/httpd-vhosts.conf

 

註釋掉這個

 

#DocumentRoot"/usr/local/apache/htdocs"

二、配置httpd-vhost.conf文件

[root@CentOS6 bin]# vim/etc/httpd/extra/httpd-vhosts.conf

把給的例子註釋掉

加上下面這個

<VirtualHost 192.168.66.100:80>

   ServerAdmin [email protected]

   DocumentRoot "/usr/local/apache/htdocs/www.huangbaoying.com"

   ServerName www.huangbaoying.com

   ErrorLog "logs/www.huangbaoying.com-error_log"

   CustomLog "logs/www.huangbaoying.com-access_log" common

</VirtualHost>

 

三、在你指定的DocumentRoot中編寫index.html

然後保存。

 

四、在你本地的hosts文件中添加

 

這個文件在

 

C:\Windows\System32\drivers\etc

 

192.168.66.100       www.hby.com

 

然後保存

五、重新啓動apache

關閉防火牆

在瀏覽器中訪問www.hby.com看看能不能訪問到


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章