nginx.conf 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. location __PATHTOCHANGE__ {
  2. alias __FINALPATH__;
  3. index index.php;
  4. if (!-e $request_filename)
  5. {
  6. rewrite ^(.+)$ __PATHTOCHANGE__/index.php?q=$1 last;
  7. rewrite ^/.*$ __PATHTOCHANGE__/index.php last;
  8. }
  9. if ($scheme = http) {
  10. rewrite ^ https://$server_name$request_uri? permanent;
  11. }
  12. client_max_body_size 30m;
  13. try_files $uri $uri/ __PATHTOCHANGE__/index.php?q=$uri&$args;
  14. # Old image system ?
  15. rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
  16. rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
  17. rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
  18. rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
  19. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
  20. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
  21. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
  22. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
  23. rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
  24. rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
  25. error_page 404 /index.php?controller=404;
  26. # Deny access to .htaccess .DS_Store .htpasswd etc
  27. location ~ /\. {
  28. deny all;
  29. }
  30. # Deny access file theme
  31. location ~ \.tpl {
  32. deny all;
  33. }
  34. location ~* \.(css|js|docx|zip|pptx|swf|txt|jpg|jpeg|png|gif|swf|webp|flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$ {
  35. expires max;
  36. log_not_found off;
  37. add_header Pragma public;
  38. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  39. }
  40. location ~ [^/]\.php(/|$) {
  41. fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  42. fastcgi_pass unix:/var/run/php5-fpm-__NAMETOCHANGE__.sock;
  43. fastcgi_index index.php;
  44. include fastcgi_params;
  45. fastcgi_param REMOTE_USER $remote_user;
  46. fastcgi_param PATH_INFO $fastcgi_path_info;
  47. fastcgi_param SCRIPT_FILENAME $request_filename;
  48. fastcgi_keep_conn on;
  49. fastcgi_intercept_errors on;
  50. fastcgi_max_temp_file_size 0;
  51. fastcgi_temp_file_write_size 256k;
  52. fastcgi_buffer_size 8k;
  53. fastcgi_buffers 64 8k;
  54. fastcgi_busy_buffers_size 8k;
  55. fastcgi_connect_timeout 300;
  56. fastcgi_read_timeout 300;
  57. fastcgi_send_timeout 300;
  58. client_max_body_size 30m;
  59. }
  60. #--PRIVATE--# Include SSOWAT user panel.
  61. #--PRIVATE--include conf.d/yunohost_panel.conf.inc;
  62. }