Appach 服务器如让IP绑定多个域名

1.开发好自己的网站放到D盘下
例如:D:/new.html
2.打开appcah服务器的httpd.conf文件
例如我的文件保存在:D:\EmpireServer\php\apache2.2\conf中
(1)找到DocumentRoot
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#注销掉DocumentRoot
#DocumentRoot "D:/EmpireServer/web"
#
# Each directory to which Apache has access can be configured with respect
(2)找到虚拟机配置
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts启用虚拟主机配置
Include conf/extra/httpd-vhosts.conf
3.打开httpd-vhosts.conf文件(位置在conf/extra/httpd-vhosts.conf

#你的项目位置
    DocumentRoot "D:/"
#你想取的域名(注意这里会和下面的hosts文件中名字相同)

    ServerName www.myself.com
#你的在浏览器中输入域名首先要打开的文件
    DirectoryIndex new.html
   
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
   

4.配置hosts文件(文件位置:C:\Windows\System32\drivers\etc\)
文件最后加上 :127.0.0.1 
 www.myself.com
5.在浏览器中输入:http://www.
myself.com即可访问D盘下的new.html文件了。

你可能感兴趣的:(Appach 服务器如让IP绑定多个域名)