I use Nginx to serve my php applications for dev purposes.
On Ubuntu it works out of the box.
I want to do the same for Node.js apps.
- Is this possible without doing
nodejs app.js
before? - How to achieve this in a single Nginx conf file?
I use Nginx to serve my php applications for dev purposes.
On Ubuntu it works out of the box.
I want to do the same for Node.js apps.
nodejs app.js
before?PHP and node.js are oil and water. PHP requires a web server to run the .php files, however node.js typically creates its own web server. 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.
nodejs app.js
before, due to the way node.js works.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.