0

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?
user3551444
  • 109
  • 10

1 Answers1

1

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.

  • This is not possible without doing nodejs app.js before, due to the way node.js works.
  • This question best answers your question regarding proxy'ing via Nginx.

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.

Community
  • 1
  • 1
Brendan
  • 2,777
  • 1
  • 18
  • 33