我想在 Apache 2.2 上設定我的虛擬主機。
因此,我可以使用我的 IP 位址和連接埠號碼來存取我的網站。
喜歡http://192.168.101.111:429對於一個站點,http://192.168.101.111:420對於其他網站等等。
我的機器作業系統為Windows 7。
我在 httpd.conf 檔案中嘗試過以下操作。
Listen 192.168.101.83:82
#chaffoteaux
<Directory "Path to project folder">
AllowOverride All
</Directory>
<VirtualHost 192.168.101.83:82>
ServerAdmin [email protected]
DirectoryIndex index.html index.htm index.php index.html.var
DocumentRoot "Path to project folder"
#ServerName dummy-host.example.com
ErrorLog logs/Zara.log
#ErrorLog logs/dummy-host.example.com-error_log
#CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
您能否建議我的配置中缺少的任何內容。
先致謝
阿維納什
答案1
您需要指定您希望 apache 偵聽的不同連接埠。
您還需要
NameVirtualHost
為您要使用的每個 IP:連接埠組合指定的指令。
然後設定您的 VirtualHost 定義。
看一下這些例子了解更多。
編輯
將 <Directory> 區塊放入 <VirtualHost> 區塊中
新增行
Order allow,deny
Allow from all
在你的目錄區塊中
如果您願意,可以在 httpd.conf 中全域更改這些設置,而不必在每個虛擬主機的基礎上指定它們。