[英]Serve nodejs app from nginx like with php?
I use Nginx to serve my php applications for dev purposes. 我使用Nginx为开发目的提供服务。
On Ubuntu it works out of the box. 在Ubuntu上,它可以直接使用。
I want to do the same for Node.js apps. 我想对Node.js应用程序执行相同的操作。
nodejs app.js
before? nodejs app.js
,这可能吗? PHP and node.js are oil and water. PHP和node.js是石油和水。 PHP requires a web server to run the .php files, however node.js typically creates its own web server.
PHP需要Web服务器来运行.php文件,但是node.js通常会创建自己的Web服务器。 Since you are creating your own web server, in many cases you wouldn't find it necessary to serve your application from Nginx, however, if you truly insisted on "serving" it from Nginx, you would need to proxy it.
由于您正在创建自己的Web服务器,因此在很多情况下,您并不需要从Nginx提供服务,但是,如果您真正坚持要从Nginx“提供”服务,则需要代理它。
nodejs app.js
before, due to the way node.js works. nodejs app.js
,这是不可能的。 As a closing remark, its good to remember that node.js does in fact (in most cases) implement its own web server, and PHP does not. 最后,请记住,node.js实际上(在大多数情况下)确实实现了自己的Web服务器,而PHP没有实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.