简体   繁体   English

我可以使用可读地址而不是http://192.168.xx/访问本地NodeJS服务器吗

[英]Can I access my local NodeJS server with readable address instead of http://192.168.x.x/

I've developed, for a structure, an application with ReactJS and NodeJS. 我已经使用ReactJS和NodeJS为结构开发了一个应用程序。 React is rendered by the NodeJS server which is running on a Raspberry Pi 3b+. React由运行在Raspberry Pi 3b +上的NodeJS服务器渲染。

The all application is local only, so to access it the employees have to type the local address of the Raspberry in their navigator like http://192.168.0.51/someroute which is not really convenient. all应用程序仅是本地应用程序,因此员工必须在其导航器中键入Raspberry的本地地址(如http://192.168.0.51/someroute)才能访问它,这确实不太方便。

So my question is : Can I, in some way, make this local adress look like a "real" adress like http://mylocalapplication/someroute . 所以我的问题是:我能否以某种方式使此本地地址看起来像“真正的”地址,例如http:// mylocalapplication / someroute

I have access to the admin panel of the router. 我可以访问路由器的管理面板。

Thanks in advance, 提前致谢,

You can achieve that by adding the IP and the domain you want to bind to your system's hosts file. 您可以通过添加要绑定到系统主机文件的IP和域来实现。 On MacOS and Ubuntu it's located at /etc/hosts . 在MacOS和Ubuntu上,它位于/etc/hosts

Just add a line in the following format: 只需添加以下格式的行:

1.2.3.4 localdomain.com

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

相关问题 如何使用服务器域名从本地计算机访问我的nodejs Web服务器? - How can I access my nodejs web server from my local computer using the server domain name? 为什么我无法从 iOs 模拟器访问我的 nodejs 本地服务器 - Why I can't access my nodejs local server from iOs simulator 如何在服务器的控制台中访问我的nodeJS应用程序? - How can I access to my nodeJS app in console on my server? 为什么不能使用Node.js中的http服务器运行本地服务器? - Why can't I get a local server running using the http-server in nodejs? 我可以强制 heroku 在 http 而不是 https 上运行我的应用程序吗? 节点 - can i force heroku to run my app on http instead of https ? nodejs 我正在 angular 中执行 http 请求,我的 x-access-token 出现但请求未授权 - I'm doing a http request in angular, my x-access-token showing up but request is unauthorized NodeJS X射线隐藏IP地址 - NodeJS X-Ray Hide IP Address 如果我使用IP地址运行Node.js服务器,则会话未初始化 - Session is not initializing if i run my nodejs server with ip address nodejs:如何使用apache http服务器而不是nodejs http服务器? - nodejs: how to use apache http server and not nodejs http server instead? nodejs http服务器无法访问apache的virtualhost - nodejs http server can not access to apache's virtualhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM