I have a React application that I run locally on port 3000. I have a node express server/api that I run on port 8000. I wanting to use ngnix locally to communicate between the applications as a reverse proxy without docker locally. I also eventually want deploy this combo to Google Compute Engine.
How would I set up ngnix locally to communicate between applications that would be successful to deploy to compute engine if given a flag of production vs dev?
I'm at a lost here. Anything would help. Much appreciated!
You can use the following code in default.conf
server {
root /var/www/html;
server_name _;
# this is the react application endpoints
location / {
try_files $uri $uri/ /index.html;
}
# this is the nodejs api endpoints
location /api {
proxy_pass http://127.0.0.1:8000;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.