Advertisement
AhmadShamli

mydomain.com.vhost

Jul 24th, 2012
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.94 KB | None | 0 0
  1. server {
  2.         listen *:80;
  3.         server_name mydomain.com www.mydomain.com;
  4.        
  5.         error_log /var/log/nginx/mydomain.com_error.log;
  6.         access_log /var/log/nginx/mydomain.com_access.log combined;
  7.  
  8.     #Only cache 200 responses, and for a default of 20 minutes.
  9.         proxy_cache_valid 200 20m;
  10.        
  11.     proxy_redirect          off;
  12.     proxy_set_header        Host            $host;
  13.     proxy_set_header        X-Real-IP       $remote_addr;
  14.     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  15.    
  16.     location / {
  17.         # If logged in, don't cache.
  18.                     if ($http_cookie ~* "jalUserName" ) {
  19.                                 set $do_not_cache 1;
  20.                         }
  21.             proxy_cache_key "$scheme://$host$request_uri $do_not_cache";
  22.             proxy_cache staticfilecache;
  23.         proxy_pass         http://123.123.123.123:321;
  24.         include /etc/nginx/proxy.conf;
  25.         limit_conn   limitC1  20;
  26.         limit_req   zone=limitR1  burst=20;
  27.  
  28.     }
  29.    
  30.     location ~* administrator {
  31.             # Don't static file cache admin-looking things.
  32.             proxy_pass         http://123.123.123.123:321;
  33.         #include /etc/nginx/proxy.conf;
  34.         limit_conn   limitC1  20;
  35.         limit_req   zone=limitR1  burst=20;
  36.         }
  37.  
  38.     location ~* \.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {
  39.                 # Cache static-looking files for 120 minutes, setting a 10 day expiry time in the HTTP header,
  40.                 # whether logged in or not (may be too heavy-handed).
  41.                 proxy_cache_valid 200 120m;
  42.                 expires 864000;
  43.                 proxy_pass         http://123.123.123.123:321;
  44.                 proxy_cache staticfilecache;
  45.         limit_conn   limitC1  20;
  46.         limit_req   zone=limitR1  burst=20;
  47.         }
  48.        
  49.     location = /50x.html {
  50.                 root   /var/www/nginx-default;
  51.         }
  52.        
  53.     # No access to .htaccess files.
  54.             location ~ /\.ht {
  55.                 deny  all;
  56.         }
  57.  
  58.    
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement