ngrok 没有找到站点

tech2023-05-31  42

ngrok 没有找到站点

This article is part of a web dev tech series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

本文是Microsoft的Web开发技术系列的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。

I recently wrote about RemoteIE which is a tool created to help developers on non-Windows OS’es to test for Microsoft Edge and Internet Explorer 11. It uses Microsoft’s RemoteApp virtualization software to create a browsing session without the need to install a VM. Developers have been sending us a lot of requests to expand it out to other versions of IE.

我最近写了有关RemoteIE的文章 ,该工具旨在帮助非Windows操作系统上的开发人员测试Microsoft Edge和Internet Explorer11。它使用Microsoft的RemoteApp虚拟化软件来创建浏览会话,而无需安装VM。 开发人员一直在向我们发送大量请求,以将其扩展到其他版本的IE。

One of the big limitations, though, is the fact that you can’t access resources or sites locally hosted on your development machine. This is a cumbersome limitation and narrows the usability of the tool for testing. It’s been nagging at me for awhile that we couldn’t use this in this fashion, but this past week I found a solution that I wanted to share.

但是,最大的限制之一是您无法访问开发计算机上本地托管的资源或站点。 这是一个繁琐的限制,并缩小了测试工具的可用性。 一直在困扰我的是我们无法以这种方式使用它,但是上周我找到了一个我想分享的解决方案。

ngrok –安全隧道到本地主机 (ngrok – Secure Tunnels to localhost)

Enter ngrok, a very cool, lightweight tool that creates a secure tunnel on your local machine along with a public URL you can use for browsing your local site.

输入ngrok ,这是一个非常酷的轻量级工具,它将在本地计算机上创建安全的隧道以及可用于浏览本地站点的公共URL。

When ngrok is running, it listens on the same port that you’re local web server is running on and proxies external requests to your local machine. This was the secret sauce I was looking for to allow RemoteIE to be able to test local sites on my Macbook.

当ngrok运行时,它将侦听您正在运行本地Web服务器的端口,并将外部请求代理到本地计算机。 这是我一直在寻找的秘诀,它允许RemoteIE能够测试Macbook上的本地站点。

Getting it to work was simple. ngrok comes as an archived download and extracting it gives you the actual app. You need to decide where to place it. In my case, I moved it to /usr/local/bin which is where I prefer to keep my non-OS executables. You can place it anywhere as long as it’s available in your path or your symlink it.

使它正常工作很简单。 ngrok是作为存档下载提供的,解压缩后即可得到实际的应用程序。 您需要确定放置位置。 就我而言,我将其移至/usr/local/bin ,在此我更喜欢保留非OS可执行文件。 您可以将其放置在任何位置,只要它在您的路径或符号链接中可用即可。

From there, it’s a simple step to get it to listen to your web server. Say you’re running your local web server on port 8080. In terminal, you’d type in: ngrok http 8080. This starts ngrok listening on port 8080 and creates the secure tunnel:

从那里开始,这是一个简单的步骤,可以使其监听您的Web服务器。 假设您正在端口8080上运行本地Web服务器。在终端中,您输入: ngrok http 8080 。 这将启动ngrok监听端口8080并创建安全隧道:

It also creates two sets of publicly available URLs that map to your local web server:

它还创建了两组公开的URL,它们映射到您的本地Web服务器:

Forwarding http://5057493e.ngrok.io -> localhost:8080 Forwarding https://5057493e.ngrok.io -> localhost:8080

转发http://5057493e.ngrok.io->本地主机:8080转发https://5057493e.ngrok.io->本地主机:8080

Dropping “http://5057493e.ngrok.io” or “https://5057493e.ngrok.io” (SSL) into your browser’s address bar should now bring up your local site. These are unique URLs that are created each time you restart ngrok making it easy to share these out for one-time testing sessions across a team. The benefit to this, of course, is that you’re now able to use RemoteIE with these public URLs to load and test your local site since to the service, your local site now looks like a staged or production website.

现在,将“ http://5057493e.ngrok.io ”或“ https://5057493e.ngrok.io ”(SSL)放到浏览器的地址栏中,应该会启动您的本地站点。 这些是唯一的URL,每次重新启动ngrok时都会创建,因此可以很容易地将它们共享给团队中的一次性测试会话。 当然,这样做的好处是,您现在可以将RemoteIE与这些公共URL一起使用,以加载和测试您的本地站点,因为使用该服务后,您的本地站点现在看起来像是已上线的网站或生产中的网站。

We’ll continue to work on making RemoteIE easier to work with but for the time being this is a solid solution for getting around this limitation of the service.

我们将继续致力于使RemoteIE更易于使用,但是暂时这是解决该服务限制的可靠解决方案。

更新资料 (Update)

My teammate Christian Heilmann tweeted about ngrok for testing Microsoft Edge via a VM. Perfect timing since it also kickstarted some replies with alternatives.

我的队友Christian Heilmann 推特上发布了有关ngrok的推文,用于通过VM测试Microsoft Edge。 完美的时机,因为它还启动了一些替代方案。

使用JavaScript进行更多操作 (More Hands-on With JavaScript)

It might surprise you a bit, but Microsoft has a bunch of free learning on many open source JavaScript topics and we’re on a mission to create a lot more with Microsoft Edge. Check out my own:

这可能会让您感到有些惊讶,但是Microsoft在许多开放源JavaScript主题上有大量免费的学习知识,我们的使命是使用Microsoft Edge创建更多内容。 看看我自己的:

Woah, I can test Microsoft Edge & IE on a Mac & Linux!

哇,我可以在Mac和Linux上测试Microsoft Edge和IE!

Measuring Success in Developer Relations

衡量开发人员关系中的成功

Or my team and colleagues:

或我的团队和同事:

Microsoft Edge Web Summit 2015 (a complete series of what to expect with the new browser, new web platform features, and guest speakers from the community)

Microsoft Edge Web Summit 2015 (关于新浏览器,新的Web平台功能以及社区来宾演讲者的期望的完整系列)

Build of //BUILD/ and Windows 10 (including the new JavaScript engine for sites and apps)

// BUILD /和Windows 10的构建 (包括用于站点和应用程序的新JavaScript引擎)

Advancing JavaScript without Breaking the Web (Christian Heilmann’s recent keynote)

在不中断网络的情况下推进JavaScript (Christian Heilmann最近的主题演讲)

Practical Performance Tips to Make your HTML/JavaScript Faster (a 7-part series from responsive design to casual games to performance optimization)

使您HTML / JavaScript更快的实用性能技巧 (从响应设计到休闲游戏到性能优化的7个系列文章)

The Modern Web Platform JumpStart (the fundamentals of HTML, CSS, and JS)

现代Web平台JumpStart (HTML,CSS和JS的基础知识)

Developing Universal Windows App with HTML and JavaScript JumpStart (use the JS you’ve already created to build an app)

使用HTML和JavaScript JumpStart开发通用Windows应用程序 (使用已经创建的JS来构建应用程序)

And some free tools: Visual Studio Code,Azure Trial, and cross-browser testing tools – all available for Mac, Linux, or Windows.

还有一些免费工具: Visual Studio Code , Azure试用版和跨浏览器测试工具 -均可用于Mac,Linux或Windows。

This article is part of a web dev tech series from Microsoft. We’re excited to share Microsoft Edge and the new EdgeHTML rendering engine with you. Get free virtual machines or test remotely on your Mac, iOS, Android, or Windows device at http://dev.modern.ie/

本文是Microsoft的Web开发技术系列的一部分。 我们很高兴与您共享Microsoft Edge和新的EdgeHTML渲染引擎 。 在http://dev.modern.ie/上获得免费的虚拟机或在Mac,iOS,Android或Windows设备上进行远程测试。

.

翻译自: https://www.sitepoint.com/use-ngrok-test-local-site/

ngrok 没有找到站点

相关资源:ngrok_Mac版
最新回复(0)