关于本地Apache开启多域名访问的操作方法

3/3/2017来源:C/C++教程人气:3043

1:加载apache配置文件httpd.conf下

Include conf/extra/httpd-vhosts.conf

2:修改httpd-vhost.conf

<VirtualHost *:80> DocumentRoot "D:/www/wuguju/trunk" ServerName cls.com ServerAlias www.cls.com </VirtualHost>

3:如果是本地服务器还需要修改hosts文件指向。 hosts文件位置: mac /etc/ windows C:\Windows\System32\drivers\etc

127.0.0.1 localhost ::1 localhost 172.16.4.65 cls.com

4:重启apache