我正在使用 WAMP 服务器来运行我的网站。我正在使用 Windows 7。
我在两台 PC 之间创建了 LAN,我想从第二台 PC 访问我的本地主机。
请注意,我没有使用 Internet 连接,因此无法使用 IP 地址。
请给我你的建议。
您必须编辑httpd.conf
并找到这一行:Listen 127.0.0.1:80
然后写下您为 LAN 设置的所需 IP。不要使用自动IP。
例如:Listen 192.168.137.1:80
我用作192.167.137.1
我的 Windows 7 的 LAN IP。重新启动 Apache 并享受共享。
IP can be any LAN or WAN IP address. But you'll want to set your firewall connection allow it.
Device connection with webserver pc can be by LAN or WAN (i.e by wifi, connectify, adhoc, cable, mypublic wifi etc)
You should follow these steps:
This IP will be of that device which has the web server.
实际上,您不需要互联网连接即可使用 IP 地址。LAN 中的每台计算机都有一个内部 IP 地址,您可以通过运行发现
ipconfig /all
在cmd中。
您可以使用服务器的 IP 地址(可能是 192.168.0.x 或 10.0.0.x 之类的)远程访问网站。
如果您找到该 ip 并且仍然无法访问该网站,则意味着 WAMP 未配置为响应该名称(您叫我什么?192.168.0.3?那不是我的名字。我是 Localhost )并且您必须修改 . ...../apache/config/httpd.conf
Listen *:80
在您的电脑连接到其他电脑后,使用以下 4 个步骤:
4 个步骤:
1-编辑此文件:httpd.conf
用于单击 wamp 服务器并选择 Apache 并选择 httpd.conf
2-查找此文本:
在下面全部
拒绝标签:
<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-更改为:拒绝这样的人
:
<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 或所有服务!!!