Can i add image browser caching on NGINX but just not to the ghost /blog location


#1

Hello im hosting a website on my nginx server and then inside /blog location i installed Ghost. I figured that for the ghost blog to show images i had to remove the images browser caching i had specified on NGINX for my website such as:

   location ~*  \.(jpg|jpeg|svg|png|gif|ico|css|js|woff)$ {
                expires 20d;
        } 

So my question is: Is it possible for me to add image browser caching NOT to the ghost /blog location but for my website.

This is my NGINX configuration:

server {
    listen 80;
    server_name boiler-electrico.com www.boiler-electrico.com;
    rewrite ^/(.*) https://boiler-electrico.com/$1 permanent;
  }


server {
listen 443 ssl http2;
    server_name www.boiler-electrico.com;
    ssl_certificate /etc/letsencrypt/live/boiler-electrico.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/boiler-electrico.com/privkey.pem;
    ssl_prefer_server_ciphers on;
    return 301 https://boiler-electrico.com$request_uri;
  }


server {
    listen 443 ssl http2;
    server_name boiler-electrico.com;
    ssl_certificate /etc/letsencrypt/live/boiler-electrico.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/boiler-electrico.com/privkey.pem;
    ssl_prefer_server_ciphers on;

    root /var/www/restrella/boiler-electrico.com;
    index index.php index.html index.htm;

location /blog {

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2369;
    }



    # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
        }

location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_index index.php;
                include fastcgi_params;
        }


        location ~*  \.(pdf)$ {
                expires 30d;
        }



location ~ /\.ht {
        deny all;
    }

}

#2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.