Apache 虛擬子網域

Apache 虛擬子網域

我正在嘗試建立虛擬子網域,但編輯 httpd-vhosts.conf 後 apache 無法啟動,錯誤日誌中沒有錯誤。

<VirtualHost 127.0.0.1:80>
  ServerAlias *.localhost
  UseCanonicalName Off    
  VirtualDocumentRoot C:/xampp/htdocs/%1
</VirtualHost>

注意:我在 Windows 上透過 xampp 運行 apache。

答案1

這是我在 Linux 中建立虛擬主機的方法:

<VirtualHost 127.0.0.1>
  DocumentRoot /var/webapps/testphp
  ServerName testphp.home.lan
</VirtualHost>

您可以使用它(替換 DocumentRoot 和 ServerName)並新增

127.0.0.1 testphp.home.lan

在你的/etc/hosts(或windows-os c:\windows\system32\drivers\etc\hosts)中並檢查主apache配置中是否有「錯誤切換器」。可能是您的錯誤日誌已關閉。

相關內容