標籤:虛擬機器主機 記事本
開啟了httpd-vhosts.conf,預設的httpd.conf預設配置失效(確保 httpd-vhosts.conf 檔案裡也開啟了虛擬機器主機配置,見第3條),訪問此IP的網域名稱將全部指向 vhosts.conf 中的第一個虛擬機器主機。
1、首先修改C盤WINDOWS\system32\drivers\etc目錄下的 hosts 檔案,用記事本開啟,加入:
127.0.0.1 localhost
127.0.0.1 www.mydomain.com
2、httpd.conf中開啟httpd-vhosts.conf
3、在虛擬機器主機設定檔案xampp\apache\conf\extra\httpd-vhosts.conf裡設定:
取消 NameVirtualHost *:80 前面的 ##
參考如下配置
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "D:/Apps/zend-eclipse-php/workspace"
<Directory "D:/Apps/zend-eclipse-php/workspace">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
ServerName send2ocean.com
ErrorLog "logs/send2ocean.com-error.log"
CustomLog "logs/send2ocean.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>