magento.stpl 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. server {
  2. listen %ip%:%web_ssl_port% ssl;
  3. server_name %domain_idn% %alias_idn%;
  4. root %sdocroot%/pub;
  5. index index.php;
  6. autoindex off;
  7. charset UTF-8;
  8. error_page 404 403 = /errors/404.php;
  9. add_header "X-UA-Compatible" "IE=Edge";
  10. ssl_certificate %ssl_pem%;
  11. ssl_certificate_key %ssl_key%;
  12. access_log /var/log/nginx/domains/%domain%.log combined;
  13. access_log /var/log/nginx/domains/%domain%.bytes bytes;
  14. error_log /var/log/nginx/domains/%domain%.error.log error;
  15. # PHP entry point for setup application
  16. location ~* ^/setup($|/) {
  17. root %sdocroot%;
  18. location ~ ^/setup/index.php {
  19. fastcgi_pass %backend_lsnr%;
  20. fastcgi_index index.php;
  21. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  22. include /etc/nginx/fastcgi_params;
  23. }
  24. location ~ ^/setup/(?!pub/). {
  25. deny all;
  26. }
  27. location ~ ^/setup/pub/ {
  28. add_header X-Frame-Options "SAMEORIGIN";
  29. }
  30. }
  31. # PHP entry point for update application
  32. location ~* ^/update($|/) {
  33. root %sdocroot%;
  34. location ~ ^/update/index.php {
  35. fastcgi_split_path_info ^(/update/index.php)(/.+)$;
  36. fastcgi_pass %backend_lsnr%;
  37. fastcgi_index index.php;
  38. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  39. fastcgi_param PATH_INFO $fastcgi_path_info;
  40. include /etc/nginx/fastcgi_params;
  41. }
  42. # Deny everything but index.php
  43. location ~ ^/update/(?!pub/). {
  44. deny all;
  45. }
  46. location ~ ^/update/pub/ {
  47. add_header X-Frame-Options "SAMEORIGIN";
  48. }
  49. }
  50. location / {
  51. try_files $uri $uri/ /index.php?$args;
  52. }
  53. location /pub/ {
  54. location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
  55. deny all;
  56. }
  57. alias %sdocroot%/pub/;
  58. add_header X-Frame-Options "SAMEORIGIN";
  59. }
  60. location /static/ {
  61. # Uncomment the following line in production mode
  62. # expires max;
  63. # Remove signature of the static files that is used to overcome the browser cache
  64. location ~ ^/static/version {
  65. rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
  66. }
  67. location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  68. add_header Cache-Control "public";
  69. add_header X-Frame-Options "SAMEORIGIN";
  70. expires +1y;
  71. if (!-f $request_filename) {
  72. rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  73. }
  74. }
  75. location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  76. add_header Cache-Control "no-store";
  77. add_header X-Frame-Options "SAMEORIGIN";
  78. expires off;
  79. if (!-f $request_filename) {
  80. rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  81. }
  82. }
  83. if (!-f $request_filename) {
  84. rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  85. }
  86. add_header X-Frame-Options "SAMEORIGIN";
  87. }
  88. location /media/ {
  89. try_files $uri $uri/ /get.php?$args;
  90. location ~ ^/media/theme_customization/.*\.xml {
  91. deny all;
  92. }
  93. location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  94. add_header Cache-Control "public";
  95. add_header X-Frame-Options "SAMEORIGIN";
  96. expires +1y;
  97. try_files $uri $uri/ /get.php?$args;
  98. }
  99. location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  100. add_header Cache-Control "no-store";
  101. add_header X-Frame-Options "SAMEORIGIN";
  102. expires off;
  103. try_files $uri $uri/ /get.php?$args;
  104. }
  105. add_header X-Frame-Options "SAMEORIGIN";
  106. }
  107. location /media/customer/ {
  108. deny all;
  109. }
  110. location /media/downloadable/ {
  111. deny all;
  112. }
  113. location /media/import/ {
  114. deny all;
  115. }
  116. # PHP entry point for main application
  117. location ~ (index|get|static|report|404|503)\.php$ {
  118. try_files $uri =404;
  119. fastcgi_pass %backend_lsnr%;
  120. fastcgi_buffers 1024 4k;
  121. fastcgi_read_timeout 600s;
  122. fastcgi_connect_timeout 600s;
  123. fastcgi_index index.php;
  124. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  125. include /etc/nginx/fastcgi_params;
  126. }
  127. gzip on;
  128. gzip_disable "msie6";
  129. gzip_comp_level 6;
  130. gzip_min_length 1100;
  131. gzip_buffers 16 8k;
  132. gzip_proxied any;
  133. gzip_types
  134. text/plain
  135. text/css
  136. text/js
  137. text/xml
  138. text/javascript
  139. application/javascript
  140. application/x-javascript
  141. application/json
  142. application/xml
  143. application/xml+rss
  144. image/svg+xml;
  145. gzip_vary on;
  146. # Banned locations (only reached if the earlier PHP entry point regexes don't match)
  147. location ~* (\.php$|\.htaccess$|\.git) {
  148. deny all;
  149. }
  150. location /vstats/ {
  151. alias %home%/%user%/web/%domain%/stats/;
  152. include %home%/%user%/conf/web/%domain%.auth*;
  153. }
  154. include /etc/nginx/conf.d/phpmyadmin.inc*;
  155. include /etc/nginx/conf.d/phppgadmin.inc*;
  156. include /etc/nginx/conf.d/webmail.inc*;
  157. include %home%/%user%/conf/web/snginx.%domain%.conf*;
  158. }