Answer the question
In order to leave comments, you need to log in
How to fix a route conflict?
upstream api {
server 127.0.0.1:7777;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
root /home/iam/project/dist;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://api/;
}
location /static/ {
alias /home/iam/cdn/uploads/;
gzip_static on;
expires max;
add_header Cache-Control public;
}
}
root /home/iam/project/dist
is also a folder static
here! /static/
Answer the question
In order to leave comments, you need to log in
upstream api {
server 127.0.0.1:7777;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
root /home/iam/project/dist;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://api/;
}
location /static/ {
try_files $uri @cdn_uploads;
}
location @cdn_uploads {
root /home/iam/cdn/uploads;
rewrite ^/static(/.*)$ $1 break;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question