Answer the question
In order to leave comments, you need to log in
How to run Nodejs in the background with Nginx?
Deploying a frontend written in React on a server that has other virtual hosts
The guys say you need to run a nodejs server.
From the point of view of Nginx settings, everything is clear -
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
sudo npm run build
Answer the question
In order to leave comments, you need to log in
sudo npm run build - builds a js file that you must include in the document. then the application will work without npm
, you need to debug the application through npm run start - then the application will only work when npm is running, but all changes made will immediately be displayed in live mode.
If the frontend needs to be run using a nodejs server, and even under sudo, then something went very wrong :)
Try pm2 .
I have successfully used supervisord. They also say that in a distribution with systemd it is very easy to write the so-called. unit and it will run on startup and restart on crash.
npm run build is to get a normal html + js bundle from a bunch of es6 / es7 flavored classes,
do npm run build in the project folder, the build butt will appear there, but with it, you can do it like with a regular html page
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question