SHARE
TWEET

Nginx CDN contenido estático

clongarela May 5th, 2016 636 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Servidor principal que se hace cargo de las peticiones
  2. server {
  3.     listen 111.222.333.444:80;
  4.     server_name cdnc1.dng.pw cdnc2.dng.pw cdnc3.dng.pw;
  5.     root /ruta/sitio/web/original/html;
  6.  
  7.     access_log  /ruta/sitio/web/original/logs/access_cndc.log;
  8.     error_log  /ruta/sitio/web/original/logs/error_cdnc.log;
  9.  
  10.     charset UTF-8;
  11.  
  12.     location ~* \.(jpg|jpeg|gif|png|ico) {
  13.         add_header Pragma "public";
  14.         add_header Cache-Control "max-age=7776000, public, must-revalidate, proxy-revalidate"; # Cache de 3 meses, en segundos
  15.         add_header X-Powered-By "CDN Images CloudFlare DNG/1.0";
  16.     }
  17.  
  18.     # Habilitamos compresión gzip
  19.     gzip on;
  20.     gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
  21.  
  22.     location ~* \.js$ {
  23.         types {}
  24.         default_type application/x-javascript;
  25.         add_header Vary "Accept-Encoding";
  26.         add_header Pragma "public";
  27.         add_header Cache-Control "max-age=7776000, public, must-revalidate, proxy-revalidate"; # Cache de 3 meses, en segundos
  28.         add_header X-Powered-By "CDN Js CloudFlare DNG/1.0";
  29.     }
  30.  
  31.     location ~* \.css$ {
  32.         types {}
  33.         default_type text/css;
  34.         add_header Vary "Accept-Encoding";
  35.         add_header Pragma "public";
  36.         add_header Cache-Control "max-age=7776000, public, must-revalidate, proxy-revalidate"; # Cache de 3 meses, en segundos
  37.         add_header X-Powered-By "CDN Css CloudFlare DNG/1.0";
  38.     }
  39.  
  40.     location  / {
  41.         deny all;
  42.     }
  43. }
RAW Paste Data
Top