U
U
Umid2018-09-07 18:17:51
Apache HTTP Server
Umid, 2018-09-07 18:17:51

How to run nodejs application on apache?

How to run a nodejs application on apache (Server: Apache/2.4.6 (Red Hat))?
There is a vps server hosting about 20 sites on apache.
The server is configured so that one of the folders contains all sites whose name is a domain.
The websites are all written in PHP.
And now, let's say there is a folder called dreamcity.uz, and I want a nodejs site to work on this domain.
I tried to just delete all the php files in this directory, put the nodejs application files there and run them, but the result is the following:
5b92969e62f8b263945868.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2018-09-07
@Softovick

To run an application on node.js, you need the node.js environment on the server itself, without it the code will not work in any way.
Almost always, a node.js web application is already running its own web server, this is a really good option and performant. No layers, usually not required. Sometimes nginx is allowed on top, as it copes better with the return of static (for example, css, js and pictures).
In your case, since the port for sites is already occupied by Apache, you just need to create an entry in it, where you can make a proxy for the port on which your node.js application will run. At the same time, it is not necessary to have direct Apache access to the folder with the application files (and it is not necessary, an extra hole).
Ideally, of course, you should get rid of Apache in favor of nginx. Since Apache will create a performance bottleneck for the application on node.js

V
Viktor Yanyshev, 2018-09-07
@villiwalla

node.js is its own web server. Hang up on port 8080 if it's not busy and Apache happens to be 80th

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question