Advertisement
Nutshell_Exchange

nginx

Dec 3rd, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.57 KB | None | 0 0
  1. server {
  2.         listen 80;
  3.         listen [::]:80 proxy_protocol;
  4.         set $cs_root /var/www/magento/nostra.life/html/web;
  5.         root $cs_root/;
  6.  
  7.         # Add index.php to the list if you are using PHP
  8.         index index.php;
  9.  
  10.         server_name nostra.life www.nostra.life;
  11.  
  12.         # enforce https
  13.         return 301 https://$server_name$request_uri;
  14.         }
  15.  
  16.  
  17. server {
  18.         listen 443 ssl http2;
  19.         listen [::]:443 ssl http2 proxy_protocol;
  20.         server_name nostra.life www.nostra.life;
  21.         set $cs_root /var/www/magento/nostra.life/html/web;
  22.         root $cs_root/;
  23.         access_log /var/log/nginx/nostra.app-access.log;
  24.         error_log  /var/log/nginx/nostra.app-error.log error;
  25.         index index.php;
  26.  
  27.         # allow larger file uploads and longer script runtimes
  28.         client_body_buffer_size  1000k;
  29.         client_header_buffer_size 1000k;
  30.         client_max_body_size 1000k;
  31.         large_client_header_buffers 4 1000k;
  32.         sendfile off;
  33.  
  34.         # strengthen ssl security
  35.         ssl_certificate /etc/ssl/certs/nostra.crt;
  36.         ssl_certificate_key /etc/ssl/certs/nostra.key;
  37.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  38.         ssl_prefer_server_ciphers on;
  39.         ssl_session_cache shared:SSL:10m;
  40.  
  41.     # images, attachments
  42.     rewrite /get_img$ $cs_root/get_img.php break;
  43.     rewrite /attachment/ $cs_root/attachment.php break;
  44.  
  45.     # catch non-existent cache filenames
  46.     location ~* /+cache/
  47. {         try_files $uri $cs_root/index.php break;     }
  48.  
  49.     # the large .htaccess block for redirecting into index.php
  50.     set $fixed_file "no";
  51.  
  52.     if ($request_filename ~* "\.(html|css|js|php|ico|gif|png|jpg)$")
  53.  
  54. {         set $fixed_file "yes";     }
  55.  
  56.     rewrite /js/ $uri break;
  57.     if ($request_filename ~* "(/plugins/[^/]*)?/(js|css|images)")
  58.  
  59. {        set $fixed_file "yes";    }
  60.  
  61.     if ($request_filename ~* "/+(admin|install|themes|videos|pdf)")
  62.  
  63. {         set $fixed_file "yes";     }
  64.  
  65.     if ($fixed_file = "no")
  66. {         rewrite .* $cs_root/index.php break;     }
  67.  
  68.     # templates
  69.     rewrite \.tpl$ $cs_root/index.php break;
  70.  
  71.     # admin interface
  72.     rewrite /admin$ $cs_root/admin.php break;
  73.     rewrite /admin/ $cs_root/admin.php break;
  74.     rewrite /admin-files $cs_root/admin.php break;
  75.  
  76. location ~ \.php$ {
  77.         try_files $uri =404;
  78.         fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  79.         fastcgi_index index.php;
  80.         fastcgi_param CORE_TYPE frameworks;
  81.         include fastcgi_params;
  82.         fastcgi_buffers 1024 4k;
  83.         fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
  84.         fastcgi_read_timeout 600s;
  85.         fastcgi_connect_timeout 600s;
  86.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  87. }
  88.  
  89. location /install/ {
  90.         fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  91.         fastcgi_index index.php;
  92.         include fastcgi_params;
  93.         fastcgi_buffers 1024 4k;
  94.         fastcgi_param  PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
  95.         fastcgi_read_timeout 600s;
  96.         fastcgi_connect_timeout 600s;
  97.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  98.         include fastcgi_params;
  99.     }
  100.  
  101. }
  102.  
  103. gzip on;
  104. gzip_disable "msie6";
  105.  
  106. gzip_comp_level 6;
  107. gzip_min_length 1100;
  108. gzip_buffers 16 8k;
  109. gzip_proxied any;
  110. gzip_types
  111.     text/plain
  112.     text/css
  113.     text/js
  114.     text/xml
  115.     text/javascript
  116.     application/javascript
  117.     application/x-javascript
  118.     application/json
  119.     application/xml
  120.     application/xml+rss
  121.     image/svg+xml;
  122. gzip_vary on;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement