0

I have bought some time ago an apache server and hosting. I would like to add some nodeJs code.

I know they are different types of servers, but maybe Is there a way to run a nodeJS server inside an apache one?

Maybe Is some other solution? What can I do?

Paul
  • 35,689
  • 11
  • 93
  • 122
Pablo
  • 9,424
  • 17
  • 55
  • 78

2 Answers2

2

You can't run Node inside Apache - but you can run Node as a separate app and have Apache "talk" to node. You should read this:

Apache and Node.js on the Same Server

Community
  • 1
  • 1
noderman
  • 1,934
  • 1
  • 20
  • 36
1

Look into how to proxy a request using apache. Basically when people hit your apache server at port 80. You want it to pass on the request to your nodejs process on whatever port its running.

I haven't used apache, however nginx is another great webserver.

See this great digital ocean tutorial using nginx. I just recently did it myself and it was pretty straight forward. Step by step.

(The nginx portion is towards the bottom of the tutorial)

matt
  • 1,680
  • 1
  • 13
  • 16