【发布时间】:2014-12-08 20:04:08
【问题描述】:
是否可以配置带有我的 IP 地址的 URL - 例如:“http://192.168.xx.yy/index.php”。情况是当我在我的 PC 中运行 Apache 服务器并在其中加载 localhost 时。我知道在使用外部服务器托管后这是可能的,但是我们有什么办法可以在我们的本地主机中进行配置?
如何配置 Apache 文件来实现这一点?我尝试在我的本地主机中,通过像这样添加它来编辑“httpd.conf” - 请告诉我我在哪里得到问题!
ServerName localhost:80
HostnameLookups Off
<VirtualHost *:80>
# This first-listed virtual host is also the default for *:80
ServerName www.example.com
ServerAlias example.com
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *:80>
ServerName other.example.com
DocumentRoot /www/otherdomain
</VirtualHost>
DocumentRoot "c:/wamp/www/"
【问题讨论】:
-
您有一个从 Internet 看不到的私有 IP。为了从本地网络外部访问本地服务器,路由器应将请求转发到端口 80 上的外部接口到带有服务器的本地 IP。使用portforward.com(第 2 步或第 3 步只是广告,请仔细查看继续链接)。仅供参考 - en.wikipedia.org/wiki/Private_network 如果您询问域名 - 仅本地网络中的 DNS 服务器,或正常的域和端口转发,或在您要访问服务器的每台计算机上手动修改
hosts文件。
标签: apache url ip-address httpd.conf