nginx.conf 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 /phpinfo/ {
  18. # add a PHP info page for convenience
  19. fastcgi_pass unix:/var/run/php5-fpm.sock;
  20. fastcgi_index index.php;
  21. fastcgi_param SCRIPT_FILENAME /var/www/index.php;
  22. include fastcgi_params;
  23. }
  24. location ~ /\. {
  25. # deny access to dotfiles
  26. access_log off;
  27. log_not_found off;
  28. deny all;
  29. }
  30. location ~ ~$ {
  31. # deny access to temp editor files, e.g. "script.php~"
  32. access_log off;
  33. log_not_found off;
  34. deny all;
  35. }
  36. location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
  37. # cache static assets
  38. expires max;
  39. add_header Pragma public;
  40. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  41. }
  42. location ~ (index)\.php$ {
  43. # filter and proxy PHP requests to PHP-FPM
  44. fastcgi_pass unix:/var/run/php5-fpm.sock;
  45. fastcgi_index index.php;
  46. include fastcgi.conf;
  47. }
  48. location ~ \.php$ {
  49. # deny access to all other PHP scripts
  50. deny all;
  51. }
  52. }
  53. }