您可以使用express發送前端html文件,例如,此代碼將發送保存在客戶端文件夾中的index.html文件: app.use(('/'), express.static('client', {redirect: false}));app.use('/api', your_routes);app.get('*', function(req, res, next){ res.sendFile(path.resolve('client/index.html'));})app.listen(3000, () => console.log('Server started at port: 3000')); 你的nginx設置應該監聽你的域名和代理到localhost端口3000(你的節點應用程序運行的地方) server { listen 80; server_name example.com www.example.com; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; p