apache2.4多站点配置教程

1.修改httpd.conf 文件

分别去掉下面两行文字前面的#号。 
#LoadModule vhost_alias_module modules/mod_vhost_alias.so 
去掉#意思是启用apache的虚拟主机功能。 

#Include conf/extra/httpd-vhosts.conf 
去掉这一行的#意思是从conf/extra/httpd-vhosts.conf这个文件导入虚拟主机配置。

2.添加/修改虚拟机配置 httpd-vhosts.conf 文件

虚拟主机配置文件httpd-vhosts.conf的路径在:

conf\extra\httpd-vhosts.conf

编辑httpd-vhosts.conf文件,添加以下内容:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-www.koostore.cn   ## 网站管理员的联系方式
    DocumentRoot "D:/XYPanel/root/koostore"      ## 网站的根目录,这里的tcioc为文件夹名称
    ServerName www.koostore.cn        ## 网站的域名
    ErrorLog "logs/dummy-www.koostore.cn-error.log"      ## 网站的错误日志
    CustomLog "logs/dummy-www.koostore.cn-access.log" common     ## 网站的访问日志
</VirtualHost>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

3.修改本地DNS指向文件 hosts文件     (网上说要,我不添加也可以...)

hosts 文件的路径为:

C:\Windows\System32\drivers\etc\hosts

编辑 hosts 文件,添加以下内容:

127.0.0.1 www.koostore.cn ## 语法: IP地址 + 空格 + 上面设置的虚拟主机域名(ServerName )

保存文件之后,重启 Apache 即可!

猜你喜欢

转载自blog.csdn.net/xueba8/article/details/78976079
今日推荐