Reputation: 488
So, I'd like to have an nginx.conf that...
Here is my current config...
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";
}
}
I'm really not clear how to have all other requests serve /index.html though. Ideas?
Upvotes: 3
Views: 4654
Reputation: 1306
Try this:
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";
}
}
Upvotes: 6