server { listen 80; listen [::]:80 proxy_protocol; set $cs_root /var/www/magento/nostra.life/html/web; root $cs_root/; # Add index.php to the list if you are using PHP index index.php; server_name nostra.life www.nostra.life; # enforce https return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2 proxy_protocol; server_name nostra.life www.nostra.life; set $cs_root /var/www/magento/nostra.life/html/web; root $cs_root/; access_log /var/log/nginx/nostra.app-access.log; error_log /var/log/nginx/nostra.app-error.log error; index index.php; # allow larger file uploads and longer script runtimes client_body_buffer_size 1000k; client_header_buffer_size 1000k; client_max_body_size 1000k; large_client_header_buffers 4 1000k; sendfile off; # strengthen ssl security ssl_certificate /etc/ssl/certs/nostra.crt; ssl_certificate_key /etc/ssl/certs/nostra.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; # images, attachments rewrite /get_img$ $cs_root/get_img.php break; rewrite /attachment/ $cs_root/attachment.php break; # catch non-existent cache filenames location ~* /+cache/ { try_files $uri $cs_root/index.php break; } # the large .htaccess block for redirecting into index.php set $fixed_file "no"; if ($request_filename ~* "\.(html|css|js|php|ico|gif|png|jpg)$") { set $fixed_file "yes"; } rewrite /js/ $uri break; if ($request_filename ~* "(/plugins/[^/]*)?/(js|css|images)") { set $fixed_file "yes"; } if ($request_filename ~* "/+(admin|install|themes|videos|pdf)") { set $fixed_file "yes"; } if ($fixed_file = "no") { rewrite .* $cs_root/index.php break; } # templates rewrite \.tpl$ $cs_root/index.php break; # admin interface rewrite /admin$ $cs_root/admin.php break; rewrite /admin/ $cs_root/admin.php break; rewrite /admin-files $cs_root/admin.php break; location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param CORE_TYPE frameworks; include fastcgi_params; fastcgi_buffers 1024 4k; fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000"; fastcgi_read_timeout 600s; fastcgi_connect_timeout 600s; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location /install/ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_buffers 1024 4k; fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000"; fastcgi_read_timeout 600s; fastcgi_connect_timeout 600s; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } gzip on; gzip_disable "msie6"; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; gzip_proxied any; gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss image/svg+xml; gzip_vary on;