我已经用nodejs 创建了一个restful api,并且计划使用sapper/svelte 作为前端。最后,这些将是单独的应用程序,我想在具有相同域的同一服务器上运行它们。这种做法合理吗?如果是,我的 nginx 配置文件应该是什么样子?如果不是,我的方法应该是什么?
这是我的 api 的配置:
server {
server_name domain.name;
location / {
proxy_pass http://localhost:5000;
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;
}
.
.
.
}
Run Code Online (Sandbox Code Playgroud)