nginx.conf 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. location __PATHTOCHANGE__ {
  2. alias __FINALPATH__;
  3. index index.php;
  4. if (!-e $request_filename)
  5. {
  6. # /prestashop/index.php?id_category=5&controller=category
  7. rewrite ^/([^/]*)/recherche/(.*)$ __PATHTOCHANGE__/index.php?id_categorie$1&controller$2 last;
  8. # rewrite "^__PATHTOCHANGE__/([a-zA-Z]+)/([a-zA-Z]+)$" /index.php?id_category=$1&controller=$2 last;
  9. rewrite ^(.+)$ __PATHTOCHANGE__/index.php?q=$1 last;
  10. rewrite ^/.*$ __PATHTOCHANGE__/index.php last;
  11. }
  12. if ($scheme = http) {
  13. rewrite ^ https://$server_name$request_uri? permanent;
  14. }
  15. client_max_body_size 30m;
  16. # Add headers to serve security related headers
  17. add_header Strict-Transport-Security "max-age=15768000;";
  18. add_header X-Content-Type-Options nosniff;
  19. add_header X-Frame-Options "SAMEORIGIN";
  20. add_header X-XSS-Protection "1; mode=block";
  21. add_header X-Robots-Tag none;
  22. add_header X-Download-Options noopen;
  23. add_header X-Permitted-Cross-Domain-Policies none;
  24. try_files $uri $uri/ /__PATHTOCHANGE__/index.php?q=$uri&$args;
  25. # Old image system ?
  26. rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
  27. rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
  28. 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;
  29. 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;
  30. 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;
  31. 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;
  32. 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;
  33. 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;
  34. rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
  35. rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
  36. # Symfony controllers
  37. # location ~ /(international|_profiler|module|product|combination|specific-price)/(.*)$ {
  38. # try_files $uri $uri/ /index.php?q=$uri&$args $admin_dir/index.php$is_args$args;
  39. # }
  40. # Redirect needed to "hide" index.php
  41. # location / {
  42. # try_files $uri $uri/ /index.php$uri&$args;
  43. # }
  44. error_page 404 /index.php?controller=404;
  45. # Deny access to .htaccess .DS_Store .htpasswd etc
  46. location ~ /\. {
  47. deny all;
  48. }
  49. # Deny access file theme
  50. location ~ \.tpl {
  51. deny all;
  52. }
  53. 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)$ {
  54. expires max;
  55. log_not_found off;
  56. add_header Pragma public;
  57. add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  58. }
  59. location ~ [^/]\.php(/|$) {
  60. fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  61. fastcgi_pass unix:/var/run/php5-fpm-__NAMETOCHANGE__.sock;
  62. fastcgi_index index.php;
  63. include fastcgi_params;
  64. fastcgi_param REMOTE_USER $remote_user;
  65. fastcgi_param PATH_INFO $fastcgi_path_info;
  66. fastcgi_param SCRIPT_FILENAME $request_filename;
  67. fastcgi_keep_conn on;
  68. fastcgi_intercept_errors on;
  69. fastcgi_max_temp_file_size 0;
  70. fastcgi_temp_file_write_size 256k;
  71. fastcgi_buffer_size 8k;
  72. fastcgi_buffers 64 8k;
  73. fastcgi_busy_buffers_size 8k;
  74. fastcgi_connect_timeout 30;
  75. fastcgi_read_timeout 30s;
  76. fastcgi_send_timeout 30s;
  77. client_max_body_size 10m;
  78. }
  79. #--PRIVATE--# Include SSOWAT user panel.
  80. #--PRIVATE--include conf.d/yunohost_panel.conf.inc;
  81. }