问题描述
首先,我阅读了至少 20 篇关于这个主题的文章,但没有一篇能匹配场景,我多次搞砸了这个过程.因此,如果有任何帮助将不胜感激,我会通过提供我的特定场景来提供帮助.
笔记本电脑或其他设备通过无线路由器连接.
我试过了:
- 在防火墙上启用端口 80.什么都没发生.
- 运行
ping
、ipconfig
并在那里尝试 IPv4 地址,拒绝访问或将我带到 verizon(我的 ISP),路由器配置页面. - 尝试过配置 Apache,一团糟,从未在众多帖子中获得所有授权设置,并尝试了其中一个有希望的,但它使我的 WAMP 崩溃,必须经历所有麻烦并重新安装.
我真正想要实现的只是让所有连接到该无线路由器的用户都能访问我的 Win8 托管 WAMP 站点.
我想知道是否有任何具体的步骤可以让它真正发挥作用?
Win8.1 上的 WAMP 2.4.笔记本电脑托管本地网站.
有关如何在 WAMPServer 3 中执行此操作,请参阅本文末尾
对于 WampServer 2.5 和以前的版本
WAMPServer 旨在成为单座开发人员工具.因此,Apache 默认配置为仅允许从运行服务器的 PC 访问,即 localhost 或 127.0.0.1 或 ::1
但由于它是 Apache 的完整版本,因此您只需要对所使用的服务器有一点了解.
最简单的方法(用锤子敲碎坚果)是使用Put Online"wampmanager 菜单选项.
左键单击 wampmanager 图标 ->上线
然而,这告诉 Apache 它可以接受来自宇宙中任何 IP 地址的连接.只要您没有在路由器上转发端口 80,这不是问题,或者将来永远不会尝试.
更明智的方法是编辑 httpd.conf 文件(再次使用 wampmanager 菜单的 )并手动更改 Apache 访问安全.
左键单击 wampmanager 图标 ->阿帕奇->配置文件
这会在记事本中启动 httpd.conf 文件.
查找此文件的这一部分
## Options 指令的可能值为None"、All"、# 或以下任意组合:# 索引包括 FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## 注意MultiViews"必须*明确地* ---Options All";# 不给你.## Options 指令既复杂又重要.请参见# http://httpd.apache.org/docs/2.4/mod/core.html#options# 想要查询更多的信息.#期权索引 FollowSymLinks## AllowOverride 控制可以在 .htaccess 文件中放置哪些指令.# 它可以是All"、None"或关键字的任意组合:# AllowOverride FileInfo AuthConfig 限制#允许覆盖所有## 控制谁可以从这个服务器获取东西.## 要求所有授予# onlineoffline 标签 - 不要删除订单拒绝,允许拒绝所有人允许来自 127.0.0.1允许从 ::1允许来自本地主机</目录>
现在假设您的本地网络子网使用地址范围 192.168.0.?
在Allow from localhost
允许来自 192.168.0
这将告诉 Apache 允许从该子网上的任何 IP 地址访问它.当然,您需要检查您的路由器是否设置为使用 192.168.0 范围.
只需从命令窗口 ipconfig
输入此命令并查看标记为 IPv4 地址
的行即可完成此操作.然后使用地址的前 3 个部分进去看看.
例如,如果你看起来像这样:-
IPv4 地址...........: 192.168.2.11
你会使用
允许来自 192.168.2
Apache 2.4 用户更新
当然,如果您使用的是 Apache 2.4,则此语法已更改.
您应该替换此部分的所有内容:
订单拒绝,允许拒绝所有人允许来自 127.0.0.1允许从 ::1允许来自本地主机
有了这个,使用新的 Apache 2.4 语法
需要本地需要 ip 192.168.0
你不应该只是将它添加到 httpd.conf
中,它必须是一个替换.
WAMPServer 3 及以上版本
在 WAMPServer 3 中,默认定义了一个虚拟主机.因此,上述建议不起作用.您不再需要对 httpd.conf
文件进行任何修改.你应该保持原样.
相反,保留服务器 OFFLINE
,因为此功能已失效且不再有效,这就是 Online/Offline
菜单已成为可选菜单并默认关闭的原因.
现在您应该编辑 \wamp\bin\apache\apache{version}\conf\extra\httpd-vhosts.conf
文件.在 WAMPServer3.0.6 及以上版本中,实际上有一个菜单可以在您的编辑器中打开此文件
左键点击 wampmanager ->阿帕奇->httpd-vhost.conf
就像一直存在的那个编辑你的 httpd.conf
文件一样.
如果您没有添加任何自己的虚拟主机,它应该看起来像这样
## 虚拟主机#<虚拟主机 *:80>服务器名称本地主机文档根 c:/wamp/www<目录"c:/wamp/www/">选项 +Indexes +FollowSymLinks +MultiViews允许覆盖所有需要本地</目录></虚拟主机>现在只需更改 Require
参数以满足您的需求 EG
如果您想允许从任何地方访问,请将 Require local
替换为
要求所有授予
如果您想更加具体和安全,并且只允许您子网中的 IP 地址,请添加这样的访问权限以允许您子网中的任何 PC
需要本地需要 ip 192.168.1
或者更具体
需要本地需要 ip 192.168.1.100需要 ip 192.168.1.101
First of all, I read at least 20 articles about this topic, and not one of them can match up the scenario and I screwed up the process numerous times. So I turn help by offering my specific scenario if any help will be appreciated.
Laptops or other devices are connected through a wireless router.
I've tried:
- Enable Port 80 on firewall. nothing happened.
- Run
ping
,ipconfig
and tried IPv4 address there, denied access or bring me to verizon (my ISP), router config page. - Tried config Apache, was a mess, never get all the authorization setup in numerous posts and tried one of promising one, which crashed my WAMP, have to went through all the trouble and reinstall.
What I really tried to accomplish is really simply allow all users connect to that wireless router be able to acces my Win8 hosted WAMP sites.
I wonder if there is any specific steps that I can walk through to make it really work?
WAMP 2.4 on Win8.1.Laptop host local sites.
See the end of this post for how to do this in WAMPServer 3
For WampServer 2.5 and previous versions
WAMPServer is designed to be a single seat developers tool. Apache is therefore configure by default to only allow access from the PC running the server i.e. localhost or 127.0.0.1 or ::1
But as it is a full version of Apache all you need is a little knowledge of the server you are using.
The simple ( hammer to crack a nut ) way is to use the 'Put Online' wampmanager menu option.
left click wampmanager icon -> Put Online
This however tells Apache it can accept connections from any ip address in the universe. That's not a problem as long as you have not port forwarded port 80 on your router, or never ever will attempt to in the future.
The more sensible way is to edit the httpd.conf file ( again using the wampmanager menu's ) and change the Apache access security manually.
left click wampmanager icon -> Apache -> httpd.conf
This launches the httpd.conf file in notepad.
Look for this section of this file
<Directory "d:/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.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>
Now assuming your local network subnet uses the address range 192.168.0.?
Add this line after Allow from localhost
Allow from 192.168.0
This will tell Apache that it is allowed to be accessed from any ip address on that subnet.Of course you will need to check that your router is set to use the 192.168.0 range.
This is simply done by entering this command from a command window ipconfig
and looking at the line labeled IPv4 Address.
you then use the first 3 sections of the address you see in there.
For example if yours looked like this:-
IPv4 Address. . . . . . . . . . . : 192.168.2.11
You would use
Allow from 192.168.2
UPDATE for Apache 2.4 users
Of course if you are using Apache 2.4 the syntax for this has changed.
You should replace ALL of this section :
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
With this, using the new Apache 2.4 syntax
Require local
Require ip 192.168.0
You should not just add this into httpd.conf
it must be a replace.
For WAMPServer 3 and above
In WAMPServer 3 there is a Virtual Host defined by default. Therefore the above suggestions do not work. You no longer need to make ANY amendments to the httpd.conf
file. You should leave it exactly as you find it.
Instead, leave the server OFFLINE
as this funtionality is defunct and no longer works, which is why the Online/Offline
menu has become optional and turned off by default.
Now you should edit the \wamp\bin\apache\apache{version}\conf\extra\httpd-vhosts.conf
file. In WAMPServer3.0.6 and above there is actually a menu that will open this file in your editor
left click wampmanager -> Apache -> httpd-vhost.conf
just like the one that has always existsed that edits your httpd.conf
file.
It should look like this if you have not added any of your own Virtual Hosts
#
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Now simply change the Require
parameter to suite your needs EG
If you want to allow access from anywhere replace Require local
with
Require all granted
If you want to be more specific and secure and only allow ip addresses within your subnet add access rights like this to allow any PC in your subnet
Require local
Require ip 192.168.1
Or to be even more specific
Require local
Require ip 192.168.1.100
Require ip 192.168.1.101
这篇关于如何让本地网络用户访问我的 WAMP 站点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!