2014-02-10 53 views
1

我正在研究一個傳感器系統的項目。這些傳感器基於Raspberry Pi和Web應用程序來收集和顯示基於PHP的信息。WampServer HTTP 403禁止

我已經在我的筆記本電腦以及學校的臺式電腦上安裝了Wamp Server。我在學校運行Windows 7時運行Windows 8,讓我們說學校的網絡是「SIT.edu」。

我有一個WebS.php文件我想要Raspberry Pi python腳本來訪問。使用學校的臺式計算機(IP地址,例如172.20.1.73),Raspberry Pi可以訪問位於C:\ wamp目錄中的文件並運行一個功能。

但是,當我通過筆記本電腦和LAN電纜連接到學校網絡(SIT.edu)並向Raspberry Pi的python腳本提供IP地址(例如172.20.1.74)時,Raspberry Pi上的控制檯給出了HTTP 403 Forbidden的錯誤。我曾嘗試禁用防火牆,但無濟於事。任何幫助,將不勝感激。謝謝!

+0

難道是pi中的端口被另一個服務使用?嘗試使用另一個端口號。 –

+0

@fp - 嗨,指定路徑時,沒有爲臺式計算機或我的筆記本電腦指定端口號。它被指定爲http://172.20.1.74/webS.php – Jethro

+0

聽起來像一個權限問題。確保該文件對連接到服務器的用戶具有正確的權限。 –

回答

1

檢查你的Apache。

編輯htpd.conf文件。在這裏有一些語法告訴Apache允許哪些位置(IP地址)接受連接。

由於它的設計是一個開發系統,默認情況下,它只允許運行WAMP(Apache)的PC訪問,即本地主機127.0.0.1和可能:: 1,取決於您使用的版本。

所以編輯httpd.conf文件(使用wampmanager菜單)

wampmanager -> Apache -> httpd.conf 

查找本節

<Directory "c:/wamp/www/"> 
    # 
    # Possible values for the Options directive are "None", "All", 
    # or any combination of: 
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 
    # 
    # Note that "MultiViews" must be named *explicitly* --- "Options All" 
    # doesn't give it to you. 
    # 
    # The Options directive is both complicated and important. Please see 
    # http://httpd.apache.org/docs/2.2/mod/core.html#options 
    # for more information. 
    # 
    Options Indexes FollowSymLinks 

    # 
    # AllowOverride controls what directives may be placed in .htaccess files. 
    # It can be "All", "None", or any combination of the keywords: 
    # Options FileInfo AuthConfig Limit 
    # 
    AllowOverride None 

    # 
    # Controls who can get stuff from this server. 
    # 
# onlineoffline tag - don't remove 
    Order Deny,Allow 
    Deny from all 
    Allow from 127.0.0.1 localhost 
</Directory> 

現在,您將需要添加的IP或者機器的IP的訪問你的Apache網絡服務器。像這樣做

# onlineoffline tag - don't remove 
    Order Deny,Allow 
    Deny from all 
    Allow from 127.0.0.1 localhost ::1 
    Allow from 172.20.1.74 
# Or you could allow any ip on a subnet by using just the forst 3 quartiles 
# Allow from 172.20.1 

如果您使用的是Apache 2.4,語法改變了這個如此喲ushould使用

# onlineoffline tag - don't remove 
# the equivalent of 127.0.0.1 localhost ::1 
    Require local 
# allowing by IP 
    Require ip 172.20.1.74 
# or for the whole subnet 
    Require ip 172.20.1 

請避免任何建議使用Allow from all我相信學校不希望你在他們的網絡上打開另一個攻擊媒介