Node.js Express NGINX:静态文件path与名称间隔的proxy_pass断开
所以我正在访问我的服务器在domain.com:3333但只是把它切换到domain.com/nodeapp使用上游和代理传递在我的nginxconfiguration。 redirect工作得很好,但现在链接到我的index.html(/styles/style.css&socket.io/socket.io.ks)使用的静态文件被打破,所有显示的是原始的HTML。 从index.js app.get('/nodeapp', function(req,res){ res.sendFile(path.join(__dirname, '/views', 'index.html')); }); app.use('/styles', express.static(path.join(__dirname, '/views/styles'))); 从index.html <link rel="stylesheet" type="text/css" href="styles/style.css"> <script src="socket.io/socket.io.js"></script> 从… / nginx / sites-enabled / default upstream nodeapp{ server localhost:3333 fail_timeout=0; } server{ …. location /nodeapp{ proxy_pass http://nodeapp; } …. } 我如何重新build立链接? 请注意,在我的index.js切换之前,显示的第一行是app.get('/', function(req,res){