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
тоже есть папка static
!/static/
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;
}
}