查找 NameVirtualHost *:80 去掉前面的#
在文中最底下編輯
<VirtualHost *:80>
ServerAdmin [email protected] 郵箱
DocumentRoot /var/www/html/test 在網站根目錄下新建一個目錄取名 test 本人的網站根目錄是/var/www/html/
ServerName test.域名.com
DirectoryIndex index.htm index.html index.php
</VirtualHost>
每次多編輯一個上面的內容 就多設置一個二級域名
<VirtualHost *:80>
ServerAdmin [email protected] 郵箱
DocumentRoot /var/www/html/shop 在網站根目錄下新建一個目錄取名shop
ServerName shop.域名.com
DirectoryIndex index.htm index.html index.php
</VirtualHost>
重啓一下Apache
現在去修改域名解析 讓test.域名.com 和 shop.域名.com的IP指向這臺服務器
OK 生效就可以訪問了 比如我的網站根目錄下裝的是Discuz 根目錄下test 裝的是 phpwind 根目錄下的shop 裝的是ECshop
哈哈 是不是很神奇!!!