无法使用主机名查看 wampserver

无法使用主机名查看 wampserver

我已经在 Windows 7.1 PC 上安装了 WAMPserver 2.4。

我点击了系统托盘中的 WAMPserver 图标,选择“上线”。

如果我在浏览器中加载http://hostname/(其中主机名是我的计算机名称),我会收到错误403 Forbidden

我需要做什么才能使我的 WAMPserver 公开?(在 LAN 和 WAN 内)

编辑:在httpd.conf中,有以下部分:

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# 
ServerName localhost

如果我将 localhost 更改为我的主机名,重新启动 Apache,同样的错误仍然存​​在。

答案1

我猜测它只监听 127.0.0.1:80。

打开 apache-config(典型名称是 httpd.conf、apache.conf……)并搜索一行:

Listen 127.0.0.1:80

然后将该行编辑为

Listen 80

或者

Listen your.dom.ain:80

请查看 apache 文档以获取更多信息。 http://httpd.apache.org/docs/2.2/en/bind.html

答案2

从 apache httpd 配置文件中允许您的主机

httpd.conf 文件中的默认允许拒绝

 Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
</Directory>

将您的主机添加到允许列表中

Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
     Allow from yourhost
</Directory>

答案3

如果配置您的.conf 文件不起作用。

您需要编辑主机文件。转到:C:\Windows\System32\drivers\etc。它“可能”有效

取消注释该127.0.0.1 localhost行并删除其下方的行。

所以你的主机文件将如下所示

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost

删除旧文件或将旧主机文件作为“.OLD”。或者您可以复制并替换。希望它对您有用。:))

答案4

因为我正在运行 WAMP 2.4.x,所以我编辑了我的 httpd.conf,并发现:

# onlineoffline tag - don't remove
  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1
  Allow from ::1
  Allow from localhost

并添加:

 Allow from 10.6.0.138
 Allow from 10.2.26

我的 IP 地址是 10.6.0.138。

我同事的 IP 地址是 10.2.26.*

相关内容