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