从外界访问我的网络服务器

从外界访问我的网络服务器

我已成功安装“LAMP”,并可以通过输入 10.0.2.15 访问我的 Web 服务器。如何才能在我输入域名时打开我的 Web 服务器?

答案1

联系将您的域名与路由器的外部地址结合起来,并将路由器上的 80 端口转发到服务器。

答案2

您可以购买 DNS,或者按照以下解决方案操作:

It's likely that your router is engaging in Network Address Translation.
In order to see the web page inside your LAN from outside of it:

You'll have to turn on port forwarding on the HTTP port that you're serving 
(80 is the default) to direct any traffic to the internal address. This
process varies from router to router, so you'll have to look at the manual 
that came with that device.

It's best to also set up a static IP address for the computer serving the 
website so that if it reboots, the port forwarding still works. This is unnecessary 
if you can port forward using the hostname (not typically supported). This also 
varies from router to router.

Direct your clients to your externally-facing IP address. If you don't have a 
reserved IP through your ISP, this might change from time-to-time, especially
 if you restart your modem, so I recommend...

(optional) Get an account at a dynamic dns host such as DynDNS to allow 
external users to see a persistent address. You'll have to install some software on
the server to periodically make sure that the IP address is correct.

来源

相关内容