Mastering Nginx

(Ron) #1

The NGINX HTTP Server


[ 148 ]

location ~* /sites/default/files/advagg_css/css_
[[:alnum:]]+\.css$ {

And for JavaScript is as follows:


# Advanced Aggregation module JS
location ^~ /sites/default/files/advagg_js/ {
location ~* /sites/default/files/advagg_js/js_
[[:alnum:]]+\.js$ {

The common lines to both sections are as follows:


access_log off;

add_header Pragma '';

add_header Cache-Control 'public, max-age=946080000';

add_header Accept-Ranges '';

# This is for Drupal 7
try_files $uri @drupal;

## This is for Drupal 6 (use only one)
try_files $uri /index.php?q=$no_slash_uri&$args;

}

}

# All static files will be served directly.
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|x
ml)$ {

access_log off;

expires 30d;

# Send everything all at once.
tcp_nodelay off;

# Set the OS file cache.
open_file_cache max=3000 inactive=120s;
Free download pdf