gpt4 book ai didi

apache - Raspberry Pi 作为热点,无需通过域名访问互联网

转载 作者:行者123 更新时间:2023-12-05 04:11:35 25 4
gpt4 key购买 nike

我将 RPi 设置为热点 (hostapd),用于访问 RPi 上设置的网络服务器。

这个树莓派没有连接到互联网,它只是为一些本地页面提供服务。

我安装了 Apache,所以我可以通过浏览器使用地址 http://192.168.42.1

轻松访问它

问题是如何使用域来访问它?

假设我想连接到 RPi 的 WiFi(失去我的互联网连接)然后在我的浏览器上转到 http://example.com并将我加载/重定向到 http://192.168.42.1相反。

最佳答案

您可以在要使用域访问树莓派的设备中添加主机条目。让我们假设您的 Pi 的 IP 是 192.168.1.69假设您要使用的域是 local-pi.com示例:在基于 ubuntu 的系统中:将以下 lint 添加到您的/etc/hosts 文件中:

192.168.1.69       local-pi.com

在基于 Windows 的系统中,将以下行添加到您的 C:\Windows\System32\Drivers\etc\hosts 文件中:

192.168.1.69       local-pi.com

在您的 pi 的 apache 服务器配置中添加以下行:

ServerAlias       local-pi.com

关于apache - Raspberry Pi 作为热点,无需通过域名访问互联网,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42505741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com