express - Unable to serve expressjs app from subfolder -


i new express , nginx.

i have made simple express app , configure nginx:

location /exapi {     proxy_pass http://localhost:8010;     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; } 

my expressjs app is:

    var express = require('express') var app = express()  app.get('/', function (req, res) {   res.send('hello world!') })  app.listen(8010, function () {   console.log('example app listening on port 8010!') }) 

when access vps vps_ip/exapi, response cannot /exapi, when use http://vps_ip:8010 working expected.

how can access express app vps_ip/exapi?

try rewrite in nginx:

location ~* ^/exapi {     rewrite ^/exapi/(.*) /$1 break;     subfilter /exapi /;      proxy_set_header host $host;     proxy_redirect off;     proxy_pass http://localhost:8010; } 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -