nginx.conf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. client_max_body_size 10m;
  12. index index.html index.php;
  13. server {
  14. listen 80;
  15. root /var/www/shaarli;
  16. access_log /var/log/nginx/shaarli.access.log;
  17. error_log /var/log/nginx/shaarli.error.log;
  18. location ~ /\. {
  19. # deny access to dotfiles
  20. access_log off;
  21. log_not_found off;
  22. deny all;
  23. }
  24. location ~ ~$ {
  25. # deny access to temp editor files, e.g. "script.php~"
  26. access_log off;
  27. log_not_found off;
  28. deny all;
  29. }
  30. location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
  31. # cache static assets
  32. expires max;
  33. add_header Pragma public;
  34. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  35. }
  36. location = /favicon.ico {
  37. # serve the Shaarli favicon from its custom location
  38. alias /var/www/shaarli/images/favicon.ico;
  39. }
  40. location / {
  41. # Slim - rewrite URLs
  42. try_files $uri /index.php$is_args$args;
  43. }
  44. location ~ (index)\.php$ {
  45. # Slim - split URL path into (script_filename, path_info)
  46. try_files $uri =404;
  47. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  48. # filter and proxy PHP requests to PHP-FPM
  49. fastcgi_pass unix:/var/run/php5-fpm.sock;
  50. fastcgi_index index.php;
  51. include fastcgi.conf;
  52. }
  53. location ~ \.php$ {
  54. # deny access to all other PHP scripts
  55. deny all;
  56. }
  57. }
  58. }