网站运维:windows、Linux设置Apache的虚拟主机实现本地网址访问

……………………window…………………………

环境:xampp7.3.5

1、配置host

在windows中,有一个文件:C:\Windows\System32\drivers\etc\host
添加

127.0.0.1       host.hahaha.com

在这里插入图片描述

2、配置

在D:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost 127.0.0.1:80>
    ServerAdmin [email protected]
    DocumentRoot "D:/xampp/htdocs/"
    ServerName host.hahaha.com
	
</VirtualHost>

……………………Linux…………………………

(未测试)

1、配置hosts文件

在ubuntu里面(一般linux都如此),则是在/etc下查找hosts文件,这个就是相当于那个host文件一样的存在。如果没有的话,就自己新建一个。

2、配置vhosts.conf文件

猜你喜欢

转载自blog.csdn.net/weixin_43731793/article/details/93126701