Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. #Forward paths like /js/index.php/x.js to relevant handler
  2. # location ~ .php/ {
  3. # rewrite ^(.*.php)/ $1 last;
  4. # }
  5.  
  6. server {
  7. listen 80; ## listen for ipv4; this line is default and implied
  8. listen [::]:80 default_server ipv6only=on; ## listen for ipv6
  9. listen 443 default ssl;
  10.  
  11.  
  12.  
  13.  
  14.  
  15. root /usr/share/nginx/www/xxxxxxxx/public/;
  16. index index.html index.htm;
  17.  
  18. # Make site accessible from http://<serverip/domain>/
  19. server_name xxx.xxx.xxx.xxx;
  20.  
  21. error_log /var/log/nginx/error.log; #warn; #op warn niveau word er logged
  22. #access_log off; #Disabled voor I/O besparing
  23. access_log /var/log/nginx/access.log;
  24.  
  25.  
  26.  
  27.  
  28.  
  29. location / {
  30. index index.html index.php;
  31. #autoindex on;
  32. ## If missing pass the URI to Magento's front handler
  33. try_files $uri $uri/ @handler;
  34. expires max; ##
  35. }
  36.  
  37. ## These locations need to be denied
  38. location ^~ /app/ { deny all; }
  39. location ^~ /includes/ { deny all; }
  40. location ^~ /lib/ { deny all; }
  41. location ^~ /media/downloadable/ { deny all; }
  42. location ^~ /pkginfo/ { deny all; }
  43. location ^~ /report/config.xml { deny all; }
  44. location ^~ /var/ { deny all; }
  45.  
  46.  
  47. ## Disable .htaccess and other hidden files
  48. location /. {
  49. access_log off;
  50. log_not_found off;
  51. return 404;
  52. deny all;
  53. }
  54.  
  55. ## Magento uses a common front handler
  56. location @handler {
  57. rewrite / /index.php;
  58. }
  59.  
  60. #Forward paths like /js/index.php/x.js to relevant handler
  61. # location ~ .php/ {
  62. # rewrite ^(.*.php)/ $1 last;
  63. # }
  64.  
  65. ##Rewrite for versioned CSS+JS via filemtime(file modification time)
  66. location ~* ^.+.(css|js)$ {
  67. rewrite ^(.+).(d+).(css|js)$ $1.$3 last;
  68. expires 31536000s;
  69. access_log off;
  70. log_not_found off;
  71. add_header Pragma public;
  72. add_header Cache-Control "max-age=31536000, public";
  73. }
  74.  
  75. ## php-fpm parsing
  76. location ~ .php.*$ {
  77.  
  78. ## Catch 404s that try_files miss
  79. if (!-e $request_filename) { rewrite / /index.php last; }
  80.  
  81. ## Disable cache for php files
  82. expires off;
  83.  
  84. ## php-fpm configuration
  85. fastcgi_pass unix:/var/run/php5-fpm.sock;
  86. fastcgi_param HTTPS $https if_not_empty;
  87. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  88. include fastcgi_params;
  89.  
  90. ## Store code is located at Administration > Configuration > Manage Stores
  91. fastcgi_param MAGE_RUN_CODE default;
  92. fastcgi_param MAGE_RUN_TYPE store;
  93.  
  94. ## Tweak fastcgi buffers, just in case.
  95. fastcgi_buffer_size 128k;
  96. fastcgi_buffers 256 4k;
  97. fastcgi_busy_buffers_size 256k;
  98. fastcgi_temp_file_write_size 256k;
  99.  
  100. location /. { ## Disable .htaccess and other hidden files
  101. return 404;
  102. }
  103.  
  104. location @handler { ## Magento uses a common front handler
  105. rewrite / /index.php;
  106. }
  107.  
  108. location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
  109. rewrite ^(.*.php)/ $1 last;
  110. }
  111.  
  112. location ~ .php$ { ## Execute PHP scripts
  113. if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
  114.  
  115. expires off; ## Do not cache dynamic content
  116. fastcgi_pass unix:/var/run/php5-fpm.sock;
  117. fastcgi_param HTTPS on;
  118. fastcgi_param HTTPS $https;
  119. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  120. fastcgi_param MAGE_RUN_CODE store_code; ## Store code is defined in administration > Configuration > Manage Stores
  121. fastcgi_param MAGE_RUN_TYPE store;
  122. include fastcgi_params; ## See /etc/nginx/fastcgi_params
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement