所以,我想要一个 nginx.conf ......
这是我目前的配置...
server {
listen 80;
server_name www.xyz.io;
root /opt/xyz/www;
location / {
try_files $uri $uri/ @backend;
}
location @backend {
proxy_pass http://127.0.0.1:8200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
Run Code Online (Sandbox Code Playgroud)
}
我真的不清楚如何让所有其他请求提供 /index.html 服务。想法?
尝试这个:
server {
listen 80;
server_name www.xyz.io;
root /opt/xyz/www;
# index
index index.html;
# $uri, index.html
location / {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://127.0.0.1:8200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2787 次 |
| 最近记录: |