1. upstream fastcgi_backend {
  2. server 127.0.0.1:9000;
  3. }
  4. server {
  5. listen 80;
  6. server_name www.hocvps.com;
  7. rewrite ^(.*) http://hocvps.com$1 permanent;
  8. }
  9. server {
  10. listen 80 default_server;
  11. server_name hocvps.com;
  12. set $MAGE_ROOT /home/hocvps.com/public_html;
  13. root $MAGE_ROOT/pub;
  14. index index.php index.html index.htm;
  15. autoindex off;
  16. charset UTF-8;
  17. access_log /home/hocvps.com/logs/access.log;
  18. error_log /home/hocvps.com/logs/error.log;
  19. location / {
  20. try_files $uri $uri/ /index.php?$args;
  21. }
  22. # PHP entry point for setup application
  23. location ~* ^/setup($|/) {
  24. root $MAGE_ROOT;
  25. location ~ ^/setup/index.php {
  26. fastcgi_pass fastcgi_backend;
  27. fastcgi_index index.php;
  28. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  29. include fastcgi_params;
  30. }
  31. location ~ ^/setup/(?!pub/). {
  32. deny all;
  33. }
  34. location ~ ^/setup/pub/ {
  35. add_header X-Frame-Options "SAMEORIGIN";
  36. }
  37. }
  38. # PHP entry point for update application
  39. location ~* ^/update($|/) {
  40. root $MAGE_ROOT;
  41. location ~ ^/update/index.php {
  42. fastcgi_split_path_info ^(/update/index.php)(/.+)$;
  43. fastcgi_pass fastcgi_backend;
  44. fastcgi_index index.php;
  45. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  46. fastcgi_param PATH_INFO $fastcgi_path_info;
  47. include fastcgi_params;
  48. }
  49. # Deny everything but index.php
  50. location ~ ^/update/(?!pub/). {
  51. deny all;
  52. }
  53. location ~ ^/update/pub/ {
  54. add_header X-Frame-Options "SAMEORIGIN";
  55. }
  56. }
  57. # PHP for /pub
  58. location /pub/ {
  59. location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
  60. deny all;
  61. }
  62. alias $MAGE_ROOT/pub/;
  63. add_header X-Frame-Options "SAMEORIGIN";
  64. }
  65. # PHP for /static
  66. location /static/ {
  67. # Uncomment the following line in production mode
  68. #expires max;
  69. # Remove signature of the static files that is used to overcome the browser cache
  70. location ~ ^/static/version {
  71. rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
  72. }
  73. location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  74. add_header Cache-Control "public";
  75. add_header X-Frame-Options "SAMEORIGIN";
  76. expires +1y;
  77. if (!-f $request_filename) {
  78. rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  79. }
  80. }
  81. location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  82. add_header Cache-Control "no-store";
  83. add_header X-Frame-Options "SAMEORIGIN";
  84. expires off;
  85. if (!-f $request_filename) {
  86. rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  87. }
  88. }
  89. if (!-f $request_filename) {
  90. rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
  91. }
  92. add_header X-Frame-Options "SAMEORIGIN";
  93. }
  94. # PHP for /media
  95. location /media/ {
  96. try_files $uri $uri/ /get.php?$args;
  97. location ~ ^/media/theme_customization/.*\.xml {
  98. deny all;
  99. }
  100. location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  101. add_header Cache-Control "public";
  102. add_header X-Frame-Options "SAMEORIGIN";
  103. expires +1y;
  104. try_files $uri $uri/ /get.php?$args;
  105. }
  106. location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  107. add_header Cache-Control "no-store";
  108. add_header X-Frame-Options "SAMEORIGIN";
  109. expires off;
  110. try_files $uri $uri/ /get.php?$args;
  111. }
  112. add_header X-Frame-Options "SAMEORIGIN";
  113. }
  114. location /media/customer/ {
  115. deny all;
  116. }
  117. location /media/downloadable/ {
  118. deny all;
  119. }
  120. location /media/import/ {
  121. deny all;
  122. }
  123. # PHP entry point for main application
  124. location ~ (index|get|static|report|404|503)\.php$ {
  125. try_files $uri =404;
  126. fastcgi_pass fastcgi_backend;
  127. fastcgi_buffers 1024 4k;
  128. fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
  129. fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600";
  130. fastcgi_read_timeout 600s;
  131. fastcgi_connect_timeout 600s;
  132. fastcgi_index index.php;
  133. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  134. include fastcgi_params;
  135. }
  136. # Banned locations (only reached if the earlier PHP entry point regexes don't match)
  137. location ~* (\.php$|\.htaccess$|\.git) {
  138. deny all;
  139. }
  140. # Custom configuration
  141. include /home/hocvps.com/public_html/*.conf;
  142. location /nginx_status {
  143. stub_status on;
  144. access_log off;
  145. allow 127.0.0.1;
  146. allow 45.77.34.137;
  147. deny all;
  148. }
  149. location /php_status {
  150. fastcgi_pass 127.0.0.1:9000;
  151. fastcgi_index index.php;
  152. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  153. include /etc/nginx/fastcgi_params;
  154. allow 127.0.0.1;
  155. allow 45.77.34.137;
  156. deny all;
  157. }
  158. location = /favicon.ico {
  159. log_not_found off;
  160. access_log off;
  161. }
  162. location = /robots.txt {
  163. allow all;
  164. log_not_found off;
  165. access_log off;
  166. }
  167. }

Magento2 hocvps.com