永远使用http-server部署节点应用程序 [英] Deploy node app with http-server and forever

查看:233
本文介绍了永远使用http-server部署节点应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用http-server和forever.js将我的应用程序部署到远程ubuntu服务器。但是forever.js需要JS文件的路径,而不是可执行文件的路径。因此,我无法将密钥传递给http服务器。到目前为止,最好的解决方案是通过npm在本地安装http-server并运行如下命令: forever start ./node_modules/http-server/bin/http-server 。但是在这种情况下,我无法设置端口和其他选项。最佳做法是什么?

I want to use http-server and forever.js to deploy my app to remote ubuntu server. But forever.js requires path to JS file, not to executable. So I can't pass keys to http-server. Best solution so far is to install http-server locally via npm and run something like this: forever start ./node_modules/http-server/bin/http-server. But in this case I can't set port and other options. What's the best practice?

推荐答案

您可以使用该代码设置选项。在命令结束后,只需使用可用标志即可。例如:

You can set the options using that code. Just use the available flags after the end of your command. For example:

forever start ./node_modules/http-server/bin/http-server -p 80 -d false

这篇关于永远使用http-server部署节点应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆