nginx for hosting dynamic assets
I am running a nuxt server and I found out the hard way that about hosting dynamic assets in the public directory is a no go in prod for dynamic assets.
how do I set up nginx to point to this another directory for dynamic assets.
Currrect folder holding assets is /etc/assets
Current nginx is
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
# Let's Encrypt SSL
ssl_certificate /etc/letsencrypt/live/example.com-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/exmple.com-0001/privkey.pem; # managed by Certbot
# Basic SSL config
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location /data/ {
expires off;
add_header Pragma public;
add_header Cache-Control "public";
alias /etc/assets/;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://0.0.0.0:3000;
proxy_redirect off;
}
}
How do I get asset example.com/asset/importantstuff/file?