2013-09-26 51 views
1

我有一個簡單的PHP項目,只是PHP和Apache,我想分享我的localnetwork這個項目,我怎麼能解決這個問題?在局域網上共享localhost,WAMP

我嘗試了一些在這裏創建的解決方案,但無法使其工作。

有人有什麼想法嗎?

我已經從Apache的文件夾改變我的httpd.conf中:

<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
    Order deny,allow 
    Allow from all 
</Directory> 

而改變:

Listen 80 

到:

Listen 192.168.50.1:80 

但不擦出火花。

+0

運行'ipconfig'並查看你的本地IP地址是什麼。 – Blender

+0

這很可能是防火牆/網絡問題。根據您的操作系統,您必須允許來自其他計算機的傳入連接。 – Loopo

+0

所以當你打開你的瀏覽器並輸入你的IP,你會得到一個錯誤?如果是這樣,那麼告訴什麼樣。如果它加載頁面的時間太長,那就是防火​​牆問題。 – Nazar554

回答

2

好好改回來。

此更改允許訪問您安裝的驅動器的根目錄。不是一個好的想法。換個回:

<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
    Order deny,allow 
    Deny from all 
</Directory> 

,也回

Listen 80 

假設你的網站是c:\wamp\www,如果您的子網實際上是在192.168.50像你上面的簡單的方法,以允許訪問使用您的網站在本地網絡僅是改變的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 all 

    # 
    # 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  
</Directory> 

和更改部分

# onlineoffline tag - don't remove 
    Order Deny,Allow 
    Deny from all 
    Allow from 127.0.0.1 ::1 localhost 
    Allow from 192.168.50 

Allow from 192.168.50將允許來自任何IP在該子網接入即192.168.50.1的這一部分 - > 192.168.255

如果你把你的網站到子文件夾,然後做到這一點:

<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 all 

    # 
    # 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 ::1 localhost 
</Directory> 

<Directory "c:\wamp\www\sitefolder"> 
    Options Indexes FollowSymLinks 
    AllowOverride all 
    Allow from 192.168.50 
</Directory> 

這將讓你的wampserver網頁安全,但允許訪問該網站sitefolder給大家的本地網絡。

+0

完美的作品!謝謝!! – Guerra