Manhhailua

http://codek.org

Jul 11th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 4.30 KB | None | 0 0
  1. # Centmin Mod Getting Started Guide
  2. # must read http://centminmod.com/getstarted.html
  3.  
  4. # redirect from non-www to www
  5. # uncomment, save file and restart Nginx to enable
  6. # if unsure use return 302 before using return 301
  7. # server {
  8. #   listen   80;
  9. #   server_name codek.org;
  10. #   return 301 $scheme://www.codek.org$request_uri;
  11. # }
  12.  
  13. upstream codek {
  14.   server 127.0.0.1:2368;
  15.   keepalive 64;
  16. }
  17.  
  18. proxy_cache_path /var/run/cache levels=1:2 keys_zone=CODEK_CACHE:75m inactive=24h max_size=512m;
  19.  
  20. server {
  21.  
  22.   server_name codek.org www.codek.org;
  23.  
  24.   # ngx_pagespeed & ngx_pagespeed handler
  25.   #include /usr/local/nginx/conf/pagespeed.conf;
  26.   #include /usr/local/nginx/conf/pagespeedhandler.conf;
  27.   #include /usr/local/nginx/conf/pagespeedstatslog.conf;
  28.  
  29.   #add_header X-Frame-Options SAMEORIGIN;
  30.   #add_header X-Xss-Protection "1; mode=block" always;
  31.   #add_header X-Content-Type-Options "nosniff" always;  
  32.  
  33.   # limit_conn limit_per_ip 16;
  34.   # ssi  on;
  35.  
  36.   access_log /home/nginx/domains/codek.org/log/access.log combined buffer=256k flush=60m;
  37.   error_log /home/nginx/domains/codek.org/log/error.log;
  38.  
  39.   include /usr/local/nginx/conf/autoprotect/codek.org/autoprotect-codek.org.conf;
  40.   root /home/nginx/domains/codek.org/public;
  41.   # uncomment cloudflare.conf include if using cloudflare for
  42.   # server and/or vhost site
  43.   #include /usr/local/nginx/conf/cloudflare.conf;
  44.   include /usr/local/nginx/conf/503include-main.conf;
  45.  
  46.   # prevent access to ./directories and files
  47.   # location ~ (?:^|/)\. {
  48.     # deny all;
  49.   # }
  50.  
  51.   location / {
  52.     include /usr/local/nginx/conf/503include-only.conf;
  53.  
  54.     # block common exploits, sql injections etc
  55.     #include /usr/local/nginx/conf/block.conf;
  56.  
  57.     # Enables directory listings when index file not found
  58.     #autoindex  on;
  59.  
  60.     # Shows file listing times as local time
  61.     #autoindex_localtime on;
  62.  
  63.     # Enable for vBulletin usage WITHOUT vbSEO installed
  64.     # More example Nginx vhost configurations at
  65.     # http://centminmod.com/nginx_configure.html
  66.     #try_files    $uri $uri/ /index.php;
  67.  
  68.     #proxy_cache CODEK_CACHE;
  69.     #proxy_cache_valid 200 30m;
  70.     #proxy_cache_valid 404 10m;
  71.     proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
  72.     proxy_ignore_headers Set-Cookie;
  73.     proxy_hide_header Set-Cookie;
  74.     proxy_hide_header X-powered-by;
  75.     proxy_set_header X-Real-IP $remote_addr;
  76.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  77.     proxy_set_header Host $http_host;
  78.     expires 10m;
  79.  
  80.     proxy_pass http://codek;
  81.     add_header X-Cache $upstream_cache_status;
  82.  
  83.   }
  84.  
  85.   # Static files
  86.   location ~* \.(jpg|jpeg|svg|png|gif|ico|css|js|eot|woff)$ {
  87.     # Use the nginx cache zone called APP
  88.     proxy_cache CODEK_CACHE;
  89.     # For valid responses, cache it for 1 day
  90.     proxy_cache_valid 200 1d;
  91.     # For not found, cache it for 10 minutes
  92.     proxy_cache_valid 404 10m;
  93.  
  94.     # Ghost sends Cache-Control max-age=0 on CSS/JS for now
  95.     # See https://github.com/TryGhost/Ghost/issues/1405?source=c#issuecomment-28196957
  96.     proxy_ignore_headers "Cache-Control";
  97.     access_log off;
  98.     # Allow the browser to cache static files for 30 days
  99.     expires 30d;
  100.     proxy_pass http://codek;
  101.   }
  102.  
  103.   location /content/images {
  104.     alias /home/admin/web/codek.org/public_html/content/images;
  105.     access_log off;
  106.     expires max;
  107.   }
  108.  
  109.   location /assets {
  110.     alias /home/admin/web/codek.org/public_html/content/themes/ghost-wbkd/assets;
  111.     access_log off;
  112.     expires max;
  113.   }
  114.  
  115.   location /shared {
  116.     alias /home/admin/web/codek.org/public_html/core/shared;
  117.     access_log off;
  118.     expires max;
  119.   }
  120.  
  121.   location ~ ^/(?:ghost|signout) {
  122.     proxy_set_header X-Real-IP $remote_addr;
  123.     proxy_set_header Host $http_host;
  124.     proxy_pass http://codek;
  125.     add_header Cache-Control "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0";
  126.   }
  127.  
  128.   location ~ /\.ht    {return 404;}
  129.   location ~ /\.svn/  {return 404;}
  130.   location ~ /\.git/  {return 404;}
  131.   location ~ /\.hg/   {return 404;}
  132.   location ~ /\.bzr/  {return 404;}
  133.  
  134.   # include /usr/local/nginx/conf/staticfiles.conf;
  135.   # include /usr/local/nginx/conf/php.conf;
  136.   # include /usr/local/nginx/conf/drop.conf;
  137.   # include /usr/local/nginx/conf/errorpage.conf;
  138.   include /usr/local/nginx/conf/vts_server.conf;
  139. }
Add Comment
Please, Sign In to add comment