wamp设置实现本机IP或者局域网访问

本文详细介绍了如何配置Apache HTTP服务器的基本安全设置,包括权限管理、目录访问控制等,确保服务器安全。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
  Allow from all  #以前是Deny from all
</Directory>

<Directory "F:/Program Files/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 all   #以前是Allow from 127.0.0.1

</Directory>
为了您的安全,请只打开来源可靠的网址

打开网站    取消

来自: http://hi.baidu.com/
在Windows 7环境下使用WampServer 3.3设置局域网访问本地虚拟主机,可以按照以下步骤进行操作: 1. 打开WampServer软件,确保Apache和MySQL服务都已启动,且状态为绿色。 2. 找到WampServer的安装目录下的`httpd.conf`文件,这个文件通常位于`wamp\bin\apache\apacheX.X.X\conf`目录下。用文本编辑器(如Notepad++或Visual Studio Code)打开此文件。 3. 在`httpd.conf`文件中,搜索`#Listen`,将该行更改为`Listen 80`(如果原来不是80的话)。这一步是为了让Apache服务器监听所有IP地址的80端口,而不是仅监听localhost。 4. 接下来搜索`#ServerName`,在其下添加一行,指定你的虚拟主机名称,例如: ``` ServerName your-virtual-host-name ``` 将`your-virtual-host-name`替换为你的虚拟主机名或IP地址。 5. 找到`#DocumentRoot`指令,并在其下方添加一行来指定虚拟主机的根目录,例如: ``` DocumentRoot "c:/wamp/www/your-project-folder" ``` 将`your-project-folder`替换为你的项目文件夹路径。 6. 在`httpd-vhosts.conf`文件中添加虚拟主机配置。这个文件通常位于`wamp\bin\apache\apacheX.X.X\conf\extra`目录下。添加以下内容: ``` <VirtualHost *:80> ServerName your-virtual-host-name DocumentRoot "c:/wamp/www/your-project-folder" <Directory "c:/wamp/www/your-project-folder"> Options +Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> </VirtualHost> ``` 确保替换`your-virtual-host-name`和`your-project-folder`为实际的虚拟主机名和项目文件夹路径。 7. 保存`httpd.conf`和`httpd-vhosts.conf`文件的更改,并重启WampServer服务。 8. 确保你的防火墙设置允许外部设备访问你的计算机的80端口。 9.局域网内其他设备上,打开浏览器并输入你刚才设置的虚拟主机名或IP地址(比如 http://your-virtual-host-name/),如果一切设置正确,你应该能看到你的本地虚拟主机的网页内容。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值