Apache是世界使用排名第一的Web服务器软件。作为PHP开发环境中比较常用的web服务器,相信应该有不少人有在用,有时候我们会遇到开发的项目功能需要提供给别人测试(不在服务器上,在本地)我们可以修改apache的配置文件,这样局域网内其他的电脑就可以访问到你开发的项目了。

修改 httpd.conf,下面是在wamp套件中的局部配置

<Directory "F:/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.4/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:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None

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

主要修改其中的AllowOverride NoneDeny from all

修改后如下:

<Directory "F:/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.4/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:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

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

AllowOverride All:表示支持url重写

Deny from all :允许访问