2014-12-05 86 views
0

我非常努力工作!無法從遠程機器訪問wampserver 2.5

我已經在我的win7 64bits機器上安裝了wampserver 2.5。

在httdp.conf文件,我只是註釋掉關於虛擬主機行:

Include conf/extra/httpd-vhosts.conf 

的的httpd-vhosts.conf包含:

<VirtualHost *:80> 
    DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev" 
    ServerName petsy.dev 
    ServerAlias www.petsy.dev 
    <Directory "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     <RequireAny> 
      Require local 
      Require ip 192.168.1 
     </RequireAny> 
    </Directory> 
</VirtualHost> 

(我也嘗試要求所有授權)

我第一次安裝了wampserver 2.5 64位。

我能夠從我的本地機器訪問http://petsy.dev 但是,當我試圖從我的局域網的其他機器訪問http://192.168.1.16/petsy.dev,我總是得到一個403錯誤(禁止):

[Thu Dec 04 14:43:08.519329 2014] [authz_core:error] [pid 11088:tid 776] [client 192.168.1.15:39975] AH01630: client denied by server configuration: C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev 
[Thu Dec 04 14:43:08.635335 2014] [authz_core:error] [pid 11088:tid 776] [client 192.168.1.15:39975] AH01630: client denied by server configuration: C:/wamp/www/favicon.ico 

我有遠程訪問到petsy.dev當我在遠程PC主機添加文件的行:

192.168.1.16 petsy.dev 

在這種情況下,我能,我的遠程計算機上,使用'http://petsy.dev訪問到服務器」。

首先,我不明白它在服務器端發生了什麼變化,其次我不能滿足這種解決方案,因爲我無法在智能手機上使用它。

由於我無法在任何地方找到答案,我終於嘗試安裝wampserver 2.5 32位!

同樣的問題!但有一個不同的錯誤:

我總是可以在本地訪問我的petsy.dev網站,但現在,當我嘗試從遠程訪問它時,出現404錯誤(未找到)!

這裏有阿帕奇 的訪問日誌從我的本地機器:

xxxx::7d1a:xxxx:9672:xxxx - - [05/Dec/2014:19:22:25 +0100] "GET/HTTP/1.1" 200 40438 

從我的遠程機器:

192.168.1.15 - - [05/Dec/2014:19:22:30 +0100] "GET /petsy.dev/ HTTP/1.1" 404 295 

的httpd -T回答語法OK

的httpd -S說:

VirtualHost configuration: 
*:80     is a NameVirtualHost 
     default server localhost (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:23) 
     port 80 namevhost localhost (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:23) 
       alias localhost 
     port 80 namevhost petsy.dev (C:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:34) 
       alias www.petsy.dev 
ServerRoot: "C:/wamp/bin/apache/apache2.4.9" 
Main DocumentRoot: "C:/wamp/www/" 
Main ErrorLog: "C:/wamp/logs/apache_error.log" 
Mutex rewrite-map: using_defaults 
Mutex authdigest-client: using_defaults 
Mutex default: dir="C:/wamp/bin/apache/apache2.4.9/logs/" mechanism=default 
Mutex authdigest-opaque: using_defaults 
PidFile: "C:/wamp/bin/apache/apache2.4.9/logs/httpd.pid" 
Define: DUMP_VHOSTS 
Define: DUMP_RUN_CFG 
Define: APACHE24=Apache2.4 

請,請問我犯了哪個愚蠢的錯誤?

回答

0

你不需要的<RequireAny>所以只是試試這個

<VirtualHost *:80> 
    DocumentRoot "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev" 
    ServerName petsy.dev 
    ServerAlias www.petsy.dev 
    <Directory "C:/Users/Alain/Dropbox/Website/exemples/Grafikart/Petsy_alain.dev"> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Require local 
     Require ip 192.168.1 
    </Directory> 
</VirtualHost> 

附加信息 我不認爲你知道,當你創建虛擬主機發生了什麼。

基本上,當Apache看到它已經配置了一個或多個虛擬主機時,您正在向Apache宣稱它是多個域名的服務器。該句中的重要部分是多個域名

這會導致Apache檢查每個傳入連接上的域名。然後,它會將域名與其虛擬主機定義之一相匹配,並將DocumentRoot 和潛在的其他參數更改爲在該虛擬主機中設置的參數。

所以重要的是,您在使用其他PC上的瀏覽器中使用匹配的域名,通過它知道的域名訪問Apache。

這通常是由真正的互聯網上的DNS服務器完成的,但是當你在自己的本地網絡中,即安全地在你的路由器後面時,你必須使用另一種方法。你可以設置你自己的本地DNS服務器,但那很複雜。

因此,簡單的解決方案是在網絡中的其他PC上使用HOSTS文件。

所以其他的PC(而不是在PC上運行WAMPServer)上,編輯\windows\system32\drivers\etc\hosts文件,加入

192.168.1.16 petsy.dev 

然後要麼重新啓動或爲此重新加載窗口的dnscache

啓動命令窗口使用「以管理員身份運行」,並執行這些命令,2至重新加載緩存

net stop dnscache 
net start dnscache 

現在你可以從瀏覽器中使用正確的域名在非wampserver PC像這樣

http://petsy.dev 

,瀏覽器將找到的IP地址192.168.1.16petsy.dev生活。當與192.168.1.16建立連接時,它將使用corretc域名,即petsy.dev,並且apache將找到虛擬主機並根據來自正確文件夾的VH配置和服務器頁面設置所有內容。

+0

嗨RiggsFolly,我試過了,我想我很遺憾都試過了,但我真的不能在遠程情況下獲得wampserver 2.5工作訪問使用像http:// 192.168.1.16/petsy.dev或http://192.168.1.16/www.petsy.dev的wamp id地址,或者我不知道還有什麼... – 2ndGAB 2014-12-06 13:29:24

0

這裏是一個偉大的教程
Project Links do not work on Wamp Server
回答#1爲我工作
我運行Windows 7 64位
我已經安裝在HD wampserver2.5(64位)分配給字母A
所有我的dev的網站位於A:\網站
在A:\ WAMP \ BIN \ apache的\ apache2.4.9 \的conf \額外\的httpd-vhosts.conf我有這個

<VirtualHost *:80> 
    DocumentRoot "A:/websites" 
    ServerName localhost 
    ServerAlias localhost 
    <Directory "A:/websites"> 
     AllowOverride All 
     Require local 
    </Directory> 
    ErrorLog "logs/localhost-error.log" 
    CustomLog "logs/localhost.log" common 
</VirtualHost> 
<VirtualHost *:80> 
    DocumentRoot "A:/websites/example.dev/www 
    ServerName example.dev 
    ServerAlias www.example.dev 
    <Directory "A:/websites/example.dev/www> 
     AllowOverride All 
     Require local 
     Require ip 192.168.10 
    </Directory> 
</VirtualHost> 

在計算機運行wamp我adju STED主機文件如下
127.0.0.1 example.dev
:: 1 example.dev
在我添加一個條目到主機文件
192.168.10.100例如本地遠程計算機。DEV(這是計算機運行WAMP的IP地址)
下一步就是要清除DNS緩存
打開的窗戶框,這不是Web服務器
輸入「net停止的dnscache」
輸入「net終端開始的dnscache」
打開瀏覽器,其指向example.dev和它的作品
希望這有助於