Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen *:80;
- server_name mydomain.com www.mydomain.com;
- error_log /var/log/nginx/mydomain.com_error.log;
- access_log /var/log/nginx/mydomain.com_access.log combined;
- #Only cache 200 responses, and for a default of 20 minutes.
- proxy_cache_valid 200 20m;
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- location / {
- # If logged in, don't cache.
- if ($http_cookie ~* "jalUserName" ) {
- set $do_not_cache 1;
- }
- proxy_cache_key "$scheme://$host$request_uri $do_not_cache";
- proxy_cache staticfilecache;
- proxy_pass http://123.123.123.123:321;
- include /etc/nginx/proxy.conf;
- limit_conn limitC1 20;
- limit_req zone=limitR1 burst=20;
- }
- location ~* administrator {
- # Don't static file cache admin-looking things.
- proxy_pass http://123.123.123.123:321;
- #include /etc/nginx/proxy.conf;
- limit_conn limitC1 20;
- limit_req zone=limitR1 burst=20;
- }
- location ~* \.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx)$ {
- # Cache static-looking files for 120 minutes, setting a 10 day expiry time in the HTTP header,
- # whether logged in or not (may be too heavy-handed).
- proxy_cache_valid 200 120m;
- expires 864000;
- proxy_pass http://123.123.123.123:321;
- proxy_cache staticfilecache;
- limit_conn limitC1 20;
- limit_req zone=limitR1 burst=20;
- }
- location = /50x.html {
- root /var/www/nginx-default;
- }
- # No access to .htaccess files.
- location ~ /\.ht {
- deny all;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement