配置虚拟主机

vim /usr/local/apache2/conf/httpd.conf,#Include conf/extra/httpd-vhosts.conf(把#去掉)

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

#serverAdmin [email protected](可以注释)

DocumentRoot "/data/www"

 ServerName www.123.com

 ServerAlias www.dummy-host.example.com(可以注释)

ErrorLog "logs/dummy-host.example.com-error_log"(可以注释)

customlog "logs/www.123.com-access_log" common

</VirtualHost>

配置完虚拟主机后,

vim /usr/local/apache2/conf/httpd.conf,里面的(最后的Deny改为Allow)

Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Allow from all

配置完成后,检测:/usr/local/apache2/bin/apachectl -t

重启:/usr/local/apache2/bin/apachectl restart

打开本地C盘host文件,在host文件中添加192.168.137.3(这个IP是虚拟机Linux系统ip)      www.123.com

验证:在本地运行CMD,ping www.123.com,在浏览器输入www.123.com(在www目录下一定要有index.php或者index.html)

[root@aming ]#cd /data/www

[root@aming www]#vi 1.html,在里面输入点内容

再次在浏览器访问:www.123.com/1.html

                  192.168.137.3/1.html


你可能感兴趣的:(local,检测,common,虚拟主机)