I try to make two projects running on a Azure VM. (let say app1 and app2.) Express apps.
proxy by Aginx as below:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name domain.online;
location / {
proxy_pass http://127.0.0.1:3000/;
}
location /pos/ {
proxy_pass http://127.0.0.1:8080/;
}
}
app1 works on /
app2 does NOT work on /pos, browser shows Cannot GET /
I use console.log find that
app.js is works,
routes is wroks,
routes/index.js works,
routes/modules/home.js works, because log shows ‘home’
routes/modules/home.js as below and
console did not show ‘get /’
const express = require('express')
const router = express.Router()
console.log('home')
router.get('/', (req, res) => {
console.log('get /')
res.render('index')
})
module.exports = router
apps work on localhost.
apps work on vm with docker image.
I don’t know why I cannot get the url or anything I missed?
I tried revised my app, routes for /pos or domain.online/pos but not works.
I thinkg console shows home means the url and ports setting is find.
But I just cannot GET / by router.get