I'm trying to do a simple reverse proxy to my local react app with nginx. I can't wrap my head around how this works. Do i need a root variable in location /test or maybe a alias? because nginx is looking in the wrong address. (im running my react app locally at localhost:3001)
Already tried using rewrite /test(.*) /$1 break in the "location /test"-block
this is my nginx.conf:
server {
listen 81 ;
server_name app1.localhost;
location / {
root html;
index index.html index.htm;
}
location /test {
proxy_pass http://localhost:3001;
}
}
heres the console log when i try to enter app1.localhost:81/test:

locationblocks (or, asking differently, why don't you put theproxy_passinto the/location block)?/to just show the default index.html file from nginx and/testto show my react app/testbase path. So you see requests being made like/static/js/…which actually would need to be/test/static/js/…in order to resolve correctly.server_namefor your app exclusively and put theproxy_passunder/. You can still have the default nginx site.