我正在使用WAMP服务器运行我的网站,操作系统是Windows 7。
我在两台电脑之间创建了局域网,希望从第二台电脑访问我的本地主机。
请注意,我没有使用互联网连接,因此无法使用IP地址。
请给我您的建议。
您需要编辑 httpd.conf
文件,并找到以下行:Listen 127.0.0.1:80
然后写下您设定的局域网 IP 地址,不要使用自动获取IP地址。
例如:Listen 192.168.137.1:80
我使用 192.167.137.1
作为我的 Windows 7 的局域网 IP 地址。重启 Apache 以享受共享服务。
Listen *:80
也可以。 - Muhammad QasimIP可以是任何局域网或广域网IP地址。但是您需要设置防火墙连接以允许它。
设备连接Web服务器PC可以通过局域网或广域网进行(即通过wifi、connectify、adhoc、电缆、我的公共wifi等)
你应该按照以下步骤操作:
此IP将属于具有Web服务器的设备。
实际上,使用IP地址并不需要互联网连接。局域网中的每台计算机都有一个内部IP地址,您可以通过运行命令来发现它:
ipconfig /all
在命令提示符中。
您可以使用服务器的IP地址(可能类似于192.168.0.x或10.0.0.x)远程访问网站。
如果您找到了IP地址但仍然无法访问网站,则意味着WAMP未配置为响应该名称(你叫我什么?192.168.0.3?那不是我的名字。我是本地主机),您需要修改....../apache/config/httpd.conf
Listen *:80
在您的电脑连接到其他电脑后,请按照以下4个步骤进行操作:
4个步骤:
1- 编辑此文件:httpd.conf
为此,请单击WAMP服务器,选择Apache并选择httpd.conf
2- 查找此文本:Deny from all
在下面的标记中:
<Directory "c:/wamp/www"><!-- maybe other url-->
#
# 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>
3- 将 Change 改为:Deny from none
如下所示:
<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.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 none
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
4- 重启 Apache
别忘了重启 Apache 或所有服务!!!