Answer the question
In order to leave comments, you need to log in
How to set up nginx to proxy for nodejs and CRA?
Hello!
I have an nginx server and on it I have a site on node.js.
I configured proxy_pass on the root location and the site works, but my admin panel is made on react.js, namely on CRA.
I tried to run CRA as well as node.js and set proxy_pass to 3000 port, but in the end I get a blank page, as if the script does not run at all. After that, I decided that it’s possible to just run the build version as a static site, and this is also a problem, everything starts well at the root location, and if you specify location /manager, nothing happens, error 404
Here is my nginx.conf file
events {}
http {
include mime.types;
server {
listen 80;
server_name site.ru;
location / {
proxy_pass http://localhost:5000/;
}
# Exact match
location = /manager {
root /home/vseriousv/www/manager/build;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question