r_martins

Additional parameters for <server> on MAMP PRO With M2

Aug 1st, 2019
2,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 5.39 KB | None | 0 0
  1. ## Example configuration:
  2. # upstream fastcgi_backend {
  3. #    # use tcp connection
  4. #    # server  127.0.0.1:9000;
  5. #    # or socket
  6. #    server   unix:/var/run/php/php7.0-fpm.sock;
  7. # }
  8. # server {
  9. #    listen 80;
  10. #    server_name mage.dev;
  11. #    set $MAGE_ROOT /var/www/magento2;
  12. #    include /vagrant/magento2/nginx.conf.sample;
  13. # }
  14. #
  15. ## Optional override of deployment mode. We recommend you use the
  16. ## command 'bin/magento deploy:mode:set' to switch modes instead.
  17. ##
  18. ## set $MAGE_MODE default; # or production or developer
  19. ##
  20. ## If you set MAGE_MODE in server config, you must pass the variable into the
  21. ## PHP entry point blocks, which are indicated below. You can pass
  22. ## it in using:
  23. ##
  24. ## fastcgi_param  MAGE_MODE $MAGE_MODE;
  25. ##
  26. ## In production mode, you should uncomment the 'expires' directive in the /static/ location block
  27. set $MAGE_ROOT /var/www/magento2playground/pub;
  28.  
  29.  
  30. index index.php;
  31. autoindex off;
  32. charset UTF-8;
  33. error_page 404 403 = /errors/404.php;
  34. #add_header "X-UA-Compatible" "IE=Edge";
  35.  
  36. # PHP entry point for setup application
  37. location ~* ^/setup($|/) {
  38.     root $MAGE_ROOT;
  39.     location ~ ^/setup/index.php {
  40.         fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
  41.         fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=600";
  42.         fastcgi_read_timeout 600s;
  43.         fastcgi_connect_timeout 600s;
  44.  
  45.         fastcgi_index  index.php;
  46.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  47.     }
  48.  
  49.     location ~ ^/setup/(?!pub/). {
  50.         deny all;
  51.     }
  52.  
  53.     location ~ ^/setup/pub/ {
  54.         add_header X-Frame-Options "SAMEORIGIN";
  55.     }
  56. }
  57.  
  58. # PHP entry point for update application
  59. location ~* ^/update($|/) {
  60.     root $MAGE_ROOT;
  61.  
  62.     location ~ ^/update/index.php {
  63.         fastcgi_split_path_info ^(/update/index.php)(/.+)$;
  64.         fastcgi_index  index.php;
  65.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  66.         fastcgi_param  PATH_INFO        $fastcgi_path_info;
  67.     }
  68.  
  69.     # Deny everything but index.php
  70.     location ~ ^/update/(?!pub/). {
  71.         deny all;
  72.     }
  73.  
  74.     location ~ ^/update/pub/ {
  75.         add_header X-Frame-Options "SAMEORIGIN";
  76.     }
  77. }
  78.  
  79. #location / {
  80. #    try_files $uri $uri/ /index.php$is_args$args;
  81. #}
  82.  
  83. location /pub/ {
  84.     location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
  85.         deny all;
  86.     }
  87.     alias $MAGE_ROOT/pub/;
  88.     add_header X-Frame-Options "SAMEORIGIN";
  89. }
  90.  
  91. location /static/ {
  92.     # Uncomment the following line in production mode
  93.     # expires max;
  94.  
  95.     # Remove signature of the static files that is used to overcome the browser cache
  96.     location ~ ^/static/version {
  97.         rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last;
  98.     }
  99.  
  100.     location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
  101.         add_header Cache-Control "public";
  102.         add_header X-Frame-Options "SAMEORIGIN";
  103.         expires +1y;
  104.  
  105.         if (!-f $request_filename) {
  106.             rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
  107.         }
  108.     }
  109.     location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  110.         add_header Cache-Control "no-store";
  111.         add_header X-Frame-Options "SAMEORIGIN";
  112.         expires    off;
  113.  
  114.         if (!-f $request_filename) {
  115.            rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
  116.         }
  117.     }
  118.     if (!-f $request_filename) {
  119.         rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
  120.     }
  121.     add_header X-Frame-Options "SAMEORIGIN";
  122. }
  123.  
  124. location /media/ {
  125.     try_files $uri $uri/ /get.php$is_args$args;
  126.  
  127.     location ~ ^/media/theme_customization/.*\.xml {
  128.         deny all;
  129.     }
  130.  
  131.     location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  132.         add_header Cache-Control "public";
  133.         add_header X-Frame-Options "SAMEORIGIN";
  134.         expires +1y;
  135.         try_files $uri $uri/ /get.php$is_args$args;
  136.     }
  137.     location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
  138.         add_header Cache-Control "no-store";
  139.         add_header X-Frame-Options "SAMEORIGIN";
  140.         expires    off;
  141.         try_files $uri $uri/ /get.php$is_args$args;
  142.     }
  143.     add_header X-Frame-Options "SAMEORIGIN";
  144. }
  145.  
  146. location /media/customer/ {
  147.     deny all;
  148. }
  149.  
  150. location /media/downloadable/ {
  151.     deny all;
  152. }
  153.  
  154. location /media/import/ {
  155.     deny all;
  156. }
  157.  
  158. # PHP entry point for main application
  159. location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
  160.     try_files $uri =404;
  161.     fastcgi_buffers 1024 4k;
  162.  
  163.     fastcgi_param  PHP_FLAG  "session.auto_start=off \n suhosin.session.cryptua=off";
  164.     fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
  165.     fastcgi_read_timeout 600s;
  166.     fastcgi_connect_timeout 600s;
  167.  
  168.     fastcgi_index  index.php;
  169.     fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  170. }
  171.  
  172. gzip on;
  173. gzip_disable "msie6";
  174.  
  175. gzip_comp_level 6;
  176. gzip_min_length 1100;
  177. gzip_buffers 16 8k;
  178. gzip_proxied any;
  179. gzip_types
  180.     text/plain
  181.     text/css
  182.     text/js
  183.     text/xml
  184.     text/javascript
  185.     application/javascript
  186.     application/x-javascript
  187.     application/json
  188.     application/xml
  189.     application/xml+rss
  190.     image/svg+xml;
  191. gzip_vary on;
  192.  
  193. # Banned locations (only reached if the earlier PHP entry point regexes don't match)
  194. location ~* (\.php$|\.htaccess$|\.git) {
  195.     deny all;
  196. }
Advertisement
Add Comment
Please, Sign In to add comment