Skip to content
Snippets Groups Projects
Commit 46d9204d authored by Volodymyr klymenko's avatar Volodymyr klymenko
Browse files

MAGETWO-35517: Optimize nginx.conf

parent 94e64062
Branches
No related merge requests found
......@@ -18,22 +18,17 @@
# }
root $MAGE_ROOT;
root $MAGE_ROOT/pub;
index index.php;
autoindex off;
# disable_symlinks on;
charset off;
location /setup/ {
rewrite / /setup/index.php;
location /setup/pub/ {}
location /setup {
root $MAGE_ROOT;
location /setup/index.php {
location ~ ^/setup/index.php {
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
......@@ -41,103 +36,87 @@ location /setup/ {
}
location / {
root $MAGE_ROOT/pub;
location / {
rewrite / /index.php ;
}
location /static/ {
if ($MAGE_MODE = "production") {
expires max;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
expires +1y;
if (!-f $request_filename) {
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
}
}
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
add_header Cache-Control "no-store";
expires off;
try_files $uri $uri/ /index.php?$args;
}
if (!-f $request_filename) {
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
}
location /pub {
alias $MAGE_ROOT/pub;
}
}
location /static/ {
if ($MAGE_MODE = "production") {
expires max;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
expires +1y;
if (!-f $request_filename) {
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
}
}
location /media/ {
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
expires +1y;
if (!-f $request_filename) {
rewrite / /get.php;
}
}
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
add_header Cache-Control "no-store";
expires off;
if (!-f $request_filename) {
rewrite / /get.php;
}
}
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
add_header Cache-Control "no-store";
expires off;
if (!-f $request_filename) {
rewrite / /get.php;
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
}
}
location /media/customer/ {
deny all;
if (!-f $request_filename) {
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
}
}
location /media/downloadable/ {
deny all;
location /media/ {
try_files $uri $uri/ /get.php?$args;
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
expires +1y;
try_files $uri $uri/ /get.php?$args;
}
location ~ /media/theme_customization/.*\.xml$ {
deny all;
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
add_header Cache-Control "no-store";
expires off;
try_files $uri $uri/ /get.php?$args;
}
}
location /errors/ {
try_files $uri =404;
}
location /media/customer/ {
deny all;
}
location ~ ^/errors/.*\.(xml|phtml)$ {
deny all;
}
location /media/downloadable/ {
deny all;
}
location ~ cron\.php {
deny all;
}
location ~ /media/theme_customization/.*\.xml$ {
deny all;
}
location ~ (index|get|static|report|404|503)\.php$ {
expires -1;
fastcgi_pass fastcgi_backend;
location /errors/ {
try_files $uri =404;
}
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
fastcgi_param PHP_VALUE "memory_limit=256M \n max_execution_time=600";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
fastcgi_param MAGE_MODE $MAGE_MODE;
location ~ ^/errors/.*\.(xml|phtml)$ {
deny all;
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ cron\.php {
deny all;
}
location ~ (index|get|static|report|404|503)\.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
fastcgi_param PHP_VALUE "memory_limit=256M \n max_execution_time=600";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
fastcgi_param MAGE_MODE $MAGE_MODE;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment