简体   繁体   English

我可以使用 WSL2 进行全栈开发吗?

[英]can I use WSL2 for fullstack development?

I am intrigued by the WSL2 and wondering if I can use it for full stack web development using LAMP, Node or Python.我对 WSL2 很感兴趣,想知道是否可以使用 LAMP、Node 或 Python 将它用于全栈 web 开发。 I have a dual boot with linux where I have a lamp stack.我有一个带有 linux 的双启动,我有一个灯组。 My only concern is about displaying the site on a browser.我唯一关心的是在浏览器上显示该站点。 For instance, say that I created a react app in the wsl2 and used visual studio code WSL to manage it.例如,假设我在 wsl2 中创建了一个 React 应用程序,并使用 Visual Studio 代码 WSL 来管理它。 How does this build and show in the browser in wsl2?这是如何在 wsl2 的浏览器中构建和显示的?

Thank you for your solution in advance.提前感谢您的解决方案。

Update 2022/july/07: This question was right when I started using WSL and I was wondering it's implications. 2022 年 7 月 7 日更新:当我开始使用 WSL 时,这个问题是正确的,我想知道它的含义。 I am aware that WSL's IP keeps changing so it is rather a playground than an environment.我知道 WSL 的 IP 一直在变化,所以它更像是一个游乐场而不是一个环境。 Thank you for answering this query.感谢您回答这个问题。

Look here: https://github.com/microsoft/WSL/issues/4392看这里: https://github.com/microsoft/WSL/issues/4392

You need to force 0.0.0.0 instead of using default 127.0.0.1 to localhost.您需要强制 0.0.0.0 而不是使用默认的 127.0.0.1 到 localhost。

After that you should be able to access website from local PCs browser, since ports inside WSL can be bound locally to your machine.之后,您应该能够从本地 PC 浏览器访问网站,因为 WSL 内的端口可以本地绑定到您的计算机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM