1

我有一个简单的 PHP 项目,只有 php 和 apache,我想在我的本地网络上共享这个项目,我怎么能解决这个问题?

我尝试了一些在这里建立的解决方案,但无法使其发挥作用。

有人有什么想法吗?

我已经将我的 httpd.conf 从 apache 文件夹更改为:

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

并改变:

Listen 80

至:

Listen 192.168.50.1:80

但也不要工作。

4

1 回答 1

2

好吧,全部改回来。

此更改允许访问您安装 wamp 的驱动器的根目录。不是一个好主意。S 将其改回:

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

sitefolder这将确保您的 wampserver 主页安全,但允许本地网络中的每个人访问该站点。

于 2013-09-26T19:29:45.667 回答