nginx.conf 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 /phpinfo/ {
  19. # add a PHP info page for convenience
  20. fastcgi_pass unix:/var/run/php5-fpm.sock;
  21. fastcgi_index index.php;
  22. fastcgi_param SCRIPT_FILENAME /var/www/index.php;
  23. include fastcgi_params;
  24. }
  25. location ~ /\. {
  26. # deny access to dotfiles
  27. access_log off;
  28. log_not_found off;
  29. deny all;
  30. }
  31. location ~ ~$ {
  32. # deny access to temp editor files, e.g. "script.php~"
  33. access_log off;
  34. log_not_found off;
  35. deny all;
  36. }
  37. location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
  38. # cache static assets
  39. expires max;
  40. add_header Pragma public;
  41. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  42. }
  43. location = /favicon.ico {
  44. # serve the Shaarli favicon from its custom location
  45. alias /var/www/shaarli/images/favicon.ico;
  46. }
  47. location / {
  48. # Slim - rewrite URLs
  49. try_files $uri /index.php$is_args$args;
  50. }
  51. location ~ (index)\.php$ {
  52. # Slim - split URL path into (script_filename, path_info)
  53. try_files $uri =404;
  54. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  55. # filter and proxy PHP requests to PHP-FPM
  56. fastcgi_pass unix:/var/run/php5-fpm.sock;
  57. fastcgi_index index.php;
  58. include fastcgi.conf;
  59. }
  60. location ~ \.php$ {
  61. # deny access to all other PHP scripts
  62. deny all;
  63. }
  64. }
  65. }