2011-02-07 67 views
4

我想在小型辦公室內使用xampp設置服務器。我會安全地使用xampp,但是爲了讓我的webapp可以在網絡上的其他4臺PC上使用,我只需要創建一個虛擬主機?有沒有辦法確保只能在局域網上訪問webapp?在辦公室局域網上設置xampp服務器

當前設置包括4個通過路由器共享互聯網連接。我如何設置這個作爲一個局域網,我可以提供訪問我的Web應用程序?

回答

4

在httpd.conf中的VirtualHost標記中使用.htaccess文件或設置權限。所有你需要做的就是把這個名爲.htaccess的文件夾牽着你的網頁裏面的文件:

order deny,allow 

deny from all 

allow from <ip you want> 
allow from <ip you want> 
allow from <ip you want> 
etc... 
+0

只是一個快速的側面提示,如果這不適合你,你需要檢查你的VirtualHost以確保它包含`AllowOverride All`。這使得.htaccess可以做到這一點。 – Andy 2011-02-07 20:57:28

2

也許你可以試試。

開放,並確保C:/xampp/apache/conf/httpd.conf

DocumentRoot 「C:/xampp/htdocs」 
Options Indexes FollowSymLinks 
AllowOverride all 
Order Deny,Allow 
Allow from all 

,並打開C:/xampp/apache/conf/extra/httpd-vhost.conf加..

NameVirtualHost name_site:80 
<VirtualHost name_site:80> 
DocumentRoot C:/xampp/htdocs/folder_site/ 
ServerAdmin [email protected] 
ServerName xxx.xxx.xxx.xxx 
</VirtualHost> 

說明:xxx.xxx.xxx.xxx是xampp電腦ip。 這項工作贏了7.

如果仍然沒有工作。嘗試禁用你的Windows防火牆。

相關問題