Advertisement
Guest User

Nginx self cache

a guest
Feb 27th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. server {
  2. listen 127.0.0.1:8080;
  3. server_name localhost;
  4. root /var/aegir;
  5.  
  6. location ~ \.php$ {
  7. try_files $uri =404;
  8. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  9. fastcgi_pass unix:/var/run/php5-fpm.sock;
  10. fastcgi_index index.php;
  11. include fastcgi_params;
  12. }
  13. }
  14.  
  15. server {
  16. listen 80;
  17.  
  18. root /var/aegir;
  19. index index.php index.html index.htm;
  20.  
  21. server_name aegir3-dev.aegir.local;
  22.  
  23. location / {
  24. proxy_set_header Host $host;
  25. proxy_set_header X-Real-IP $remote_addr;
  26. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  27.  
  28. proxy_pass http://localhost:8080;
  29. proxy_cache my-cache;
  30. # Define which responses to cache and for how long
  31. proxy_cache_valid 200 302 60m;
  32. proxy_cache_valid 404 5m;
  33. proxy_cache_key $host$uri$is_args$args;
  34. add_header X-Cache $upstream_cache_status;
  35. }
  36. location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ {
  37. expires 30d;
  38. }
  39.  
  40. location ~ /\.ht {
  41. deny all;
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement