I have an Nginx server running and redirecting proxy to a node server:
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri /index.html;
}
location /api {
proxy_pass http://node_server:9000;
}
Site URL is example.com
, but when you go to example.com/api
, it should go to the root of the node server.
When I do app.use('/', indexRouter);
, though, it doesn't work.
I have to do app.use('/api', indexRouter);
.