是否可以在仅端口不同的同一个(子)域上运行客户端应用程序和 API?
app.mydomain.com <- client app
app.mydomain.com:8080 <- api
我的客户端应用程序配置正在运行,如下所示:
server {
listen 80;
server_name app.mydomain.com;
root /var/www/app.mydomain.com;
index index.html index.htm;
# Always serve index.html for any request
location / {
root /var/www/app.mydomain.com;
try_files $uri /index.html;
}
}
我的 api 配置(此端口上的 url 已失效):
server {
listen 8080;
server_name app.mydomain.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;
proxy_cache_bypass $http_upgrade;
}
}
谢谢