nginx.conf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. user www-data www-data;
  2. daemon off;
  3. worker_processes 4;
  4. events {
  5. worker_connections 768;
  6. }
  7. http {
  8. include mime.types;
  9. default_type application/octet-stream;
  10. keepalive_timeout 20;
  11. index index.html index.php;
  12. server {
  13. listen 80;
  14. root /var/www/shaarli;
  15. access_log /var/log/nginx/shaarli.access.log;
  16. error_log /var/log/nginx/shaarli.error.log;
  17. location ~ /\. {
  18. # deny access to dotfiles
  19. access_log off;
  20. log_not_found off;
  21. deny all;
  22. }
  23. location ~ ~$ {
  24. # deny access to temp editor files, e.g. "script.php~"
  25. access_log off;
  26. log_not_found off;
  27. deny all;
  28. }
  29. location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
  30. # cache static assets
  31. expires max;
  32. add_header Pragma public;
  33. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  34. }
  35. location ~ (index)\.php$ {
  36. # filter and proxy PHP requests to PHP-FPM
  37. fastcgi_pass unix:/var/run/php5-fpm.sock;
  38. fastcgi_index index.php;
  39. include fastcgi.conf;
  40. }
  41. location ~ \.php$ {
  42. # deny access to all other PHP scripts
  43. deny all;
  44. }
  45. }
  46. }