如何使用我的 IP 地址使 localhost:3000 在全球范围内可用?

发布于 2024-08-06 09:48:54 字数 143 浏览 13 评论 0原文

我有一个在 localhost:3000 上运行的 Ruby on Rails 应用程序。我想使用 xxxx:3000(我的 IP 地址)使其在全球范围内可用。

我使用的是 Windows XP SP3。

I have a Ruby on Rails application running on localhost:3000. I would like to make it available world-wide, using x.x.x.x:3000 (my IP address).

I'm on Windows XP SP3.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

花之痕靓丽 2024-08-13 09:48:55

你回答了你自己的问题。 IP 地址在互联网上是唯一的。只需输入 xxxx:3000 即可。如果您想要一个人类可读的地址,例如 yahoo.com,请查看 dyndns.com 或其他免费域名服务。

You answered your own question. IP addresses are unique over the internet. Just type in the x.x.x.x:3000 and you're there. If you want a human-readable address like yahoo.com, look into dyndns.com or other free domain-name services.

十二 2024-08-13 09:48:54
  • 禁用您的防火墙
    • 确保您的路由器中启用了计算机的端口转发(如果有)

就这样! ;)

  • Disable your firewall(s)
    • Ensure you have port forwarding for your computer enabled in your router (if present)

Thats all! ;)

小忆控 2024-08-13 09:48:54

关键是在面向互联网的网络适配器上运行它,这可能已经在做了。然后,如果您位于 ADSL 或电缆调制解调器(或类似的 NAT 设备)后面,则需要在 ADSL 或电缆调制解调器上设置端口转发。最后,让一位朋友尝试与您联系。

您可能想要使用 DNS 服务 为您的 IP 地址添加别名,这样人们就不必键入它用手放进去。

The key is to run it on the internet facing network adaptor, which might already be doing. You then need to to set up port forwarding on your ADSL or cable modem, if you are behind one (or a similar NAT device). Finally, get a friend to attempt to connect to you.

You might want to use a DNS service to alias your IP address, so people don't have to type it in by hand.

坦然微笑 2024-08-13 09:48:54

如果您特别需要“localhost:3000”,请寻找@Joe答案,但如果您不关心URL,则可以使用 https://ngrok.com/

只需下载它,然后在终端中运行 ngrok localhost:3000 即可。

If you specifically need "localhost:3000", then go for @Joe answer, but if you do not care about the URL, you can use https://ngrok.com/.

Simply download it, then run ngrok localhost:3000 in terminal.

如何视而不见 2024-08-13 09:48:54

您可能需要确保一开始就有一个静态 IP 地址。您可以向您的 ISP 申请其中一项。

然后,您需要确保您有足够的安全性......有大量关于强化服务器的书籍等。

You would probably want to ensure that you have a static IP address to start with. You can apply to your ISP for one of these.

You then want to ensure that you have adequate security in place...there are tons of books etc about hardening your server.

白日梦 2024-08-13 09:48:54

如果您有静态 IP 地址,则需要关闭防火墙,然后您应该能够访问您的计算机。 (关闭防火墙并不是一个好主意,但这是一个不同的问题。)

如果您有一个动态 IP 地址(如果您不确定,您可能会这么做),您需要研究一种称为“动态 DNS”的东西,因为这将使我们的计算机拥有一个不变的名称,即使 IP 地址发生变化。请注意,随着当今各种技术的发展,您的本地 IP 地址通常与您公开看到的 IP 地址不同。如果您不确定发生了什么,这可能会有点令人困惑。

话虽如此,大多数人都会选择某种外部托管。从安全角度来看,这要好得多。查看 heroku 了解 Rails 托管。他们的免费选项可能正是您所需要的。

If you have a static IP address, you'll need to turn off your firewall and you should be able to reach your machine. (Turning off your firewall isn't really a good idea, but that's a different question.)

If you have a dynamic IP address (you probably do if you're not sure), you need to look into something called "Dynamic DNS", as this will allow our computer to have a constant name, even if the IP address changes. Note that with all the technologies at play these days, your IP address locally is usually not the same one you see publicly. This can be a bit confusing if you're not sure what's going on.

All that being said, most people would opt for some sort of external hosting. This is much better from a security standpoint. Look at heroku for rails hosting. Their free option may be exactly what you need.

2024-08-13 09:48:54

如果您在 Windows 上运行 Apache,则 Apache 托盘图标中有一个按钮。我不记得这个名字了,但大概是“上线”。当然,您必须在路由器上设置防火墙或端口转发。

If you are running Apache on Windows, there is a button in the Apache tray icon. I can not recall the name but is something like ''go live''. And of course you have to set up the firewall or port forwarding on your router.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文