Donde encuentro esta directiva o donde le instalo

Keywords: WordPress + NGINX + SSL - Google Cloud Platform - How to - Other
Description:
/etc/nginx/sites-available/default
disculpe quiero saber donde seria esa opcion para activar la cabecera de cache
. . .

Default server configuration

Expires map

map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}

server {
listen 80 default_server;
listen [::]:80 default_server;

expires $expires;

. . .

Hello @avatitaofficial,

You may want to add your default configuration to NGINX’s configuration file at /opt/bitnami/nginx/conf/nginx.conf if you want that to be a global configuration.

Regards,
Francisco de Paz

gracias ,pero como activo el activar la cabecera de cache para nginx ?

Hello @avatitaofficial,

I’m not sure I understood you, your objective is to enable browser cache for some types of HTTP content, is that right? There is already a few lines of code for cache browsing in /opt/bitnami/nginx/conf/server_blocks/wordpress-server-block.conf:

cat /opt/bitnami/nginx/conf/server_blocks/wordpress-server-block.conf

...
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
...

You can edit it to something like this to cache different types of content:

location ~*  \.(jpg|jpeg|png|gif|ico|css|js|webp|?:html)$ {
    expires max;
    log_not_found off;
}

The specific syntax that you are using as an example requires the ngx_http_map_module and the ngx_http_headers_module modules. This second one is an obsolete one that hasn’t received an update for a decade in its Github repo that we do not include.

If you want to use those modules, there is the option of dynamically loading them. You have a guide on how to load the ngx_http_headers_module module in NGINX official documentation: https://www.nginx.com/resources/wiki/extending/converting/#loading-a-dynamic-module

Regards,
Francisco de Paz

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