简体   繁体   English

如何将我电脑上当前的 node.js 开发设置部署到物理 ubuntu 服务器?

[英]How to deploy the current node.js development setup on my pc to a physical ubuntu server?

I have a node.js server app with rest api developed on my laptop right now and obviously I am able see the app on the web @ http://localhost on my laptop.我现在有一个 node.js 服务器应用程序,在我的笔记本电脑上开发了 rest api,显然我可以在我的笔记本电脑上的网络@ http://localhost上看到该应用程序。 Now I am trying to deploy this backend server to a physical linux server machine for further development.现在我正在尝试将此后端服务器部署到物理 linux 服务器机器以进行进一步开发。 I will be testing on that physical server through ssh and I have already git cloned the project into the linux server.我将通过 ssh 在该物理服务器上进行测试,并且我已经 git 将项目克隆到了 linux 服务器中。 So, now how can I set it to be able to view the http responses on the web on my laptop(because currently I'm only testing @locahost)?那么,现在我该如何设置它才能在我的笔记本电脑上查看网络上的 http 响应(因为目前我只测试 @locahost)? Also how can I use api development application such as POSTMAN with the physical server from my laptop?另外,如何将 POSTMAN 等 api 开发应用程序与笔记本电脑的物理服务器一起使用?

Thanks in advance.提前致谢。

First, from your comments we know your server have apache installed, so that page you see when navigating to http://[server IP] should be a index.html file located at /var/www/html/ .首先,根据您的评论,我们知道您的服务器安装了 apache,因此您在导航到http://[server IP]时看到的页面应该是位于/var/www/html/index.html文件。 This is probably where you want to put your cloned files.这可能是您想要放置克隆文件的地方。 Anything above html/ folder is not accessible to the browser.浏览器无法访问html/文件夹之上的任何内容。

Of course you need nodejs installed.当然你需要安装nodejs If it's not already installed, via ssh , use:如果尚未安装,请通过ssh使用:

sudo apt-get install nodejs sudo apt-get 安装 nodejs

Maybe you will need other things to install such as POSTMAN, but you'll see that installing things on ubuntu is really easy, and very well documented on the web.也许你需要安装其他东西,比如 POSTMAN,但你会发现在 ubuntu 上安装东西真的很容易,而且在网络上有很好的记录。

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

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