增加图片压缩
This commit is contained in:
parent
7a1c3d980f
commit
14e60305bc
|
@ -20,6 +20,7 @@ server {
|
||||||
}
|
}
|
||||||
location / {
|
location / {
|
||||||
add_header Strict-Transport-Security "max-age=31536000";
|
add_header Strict-Transport-Security "max-age=31536000";
|
||||||
|
fastcgi_pass_header Set-Cookie;
|
||||||
if (-f $request_filename/index.html) {
|
if (-f $request_filename/index.html) {
|
||||||
rewrite (.*) $1/index.html break;
|
rewrite (.*) $1/index.html break;
|
||||||
}
|
}
|
||||||
|
@ -32,18 +33,44 @@ server {
|
||||||
try_files $uri $uri/ /api.php;
|
try_files $uri $uri/ /api.php;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ~ "^(/images/.*\.(jpg|png|jpeg))!(\d+)-(\d+)$" {
|
||||||
|
set $w $3;
|
||||||
|
set $h $4;
|
||||||
|
rewrite ^(/images/.*\.(jpg|png|jpeg))!(\d+)-(\d+)$ $1 break;
|
||||||
|
image_filter resize $w $h;
|
||||||
|
try_files $1 404;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
add_header Access-Control-Allow-Origin "*";
|
||||||
|
add_header Pragma public;
|
||||||
|
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_cache cache_one;
|
||||||
|
proxy_cache_key $host$uri$is_args$args;
|
||||||
|
proxy_cache_valid 200 302 10d;
|
||||||
|
proxy_cache_valid 301 304 10d;
|
||||||
|
proxy_cache_valid any 10d;
|
||||||
|
expires 10d;
|
||||||
|
proxy_redirect off;
|
||||||
|
add_header wall "Stay simple, stay naive.";
|
||||||
|
}
|
||||||
location ~ .(jpg|png|gif|css|js|pdf|scss|ico|jpeg|bmp|flv|mp4|mp3|swf|wma|wmv|asf|mmf|zip|rar|gz|woff2|woff|ttf)$ {
|
location ~ .(jpg|png|gif|css|js|pdf|scss|ico|jpeg|bmp|flv|mp4|mp3|swf|wma|wmv|asf|mmf|zip|rar|gz|woff2|woff|ttf)$ {
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header Host $http_host;
|
add_header Access-Control-Allow-Origin "*";
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
add_header Pragma public;
|
||||||
proxy_set_header Connection "upgrade";
|
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
||||||
proxy_cache cache_one;
|
proxy_set_header Host $http_host;
|
||||||
proxy_cache_valid 200 302 30d;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_cache_valid 301 30d;
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_cache_valid any 30d;
|
proxy_cache cache_one;
|
||||||
expires 30d;
|
proxy_cache_key $host$uri$is_args$args;
|
||||||
proxy_redirect off;
|
proxy_cache_valid 200 302 10d;
|
||||||
add_header wall "Stay simple, stay naive.";
|
proxy_cache_valid 301 304 10d;
|
||||||
|
proxy_cache_valid any 10d;
|
||||||
|
expires 10d;
|
||||||
|
proxy_redirect off;
|
||||||
|
add_header wall "Stay simple, stay naive.";
|
||||||
}
|
}
|
||||||
location /ads.txt {
|
location /ads.txt {
|
||||||
autoindex on;
|
autoindex on;
|
||||||
|
@ -61,6 +88,7 @@ server {
|
||||||
include snippets/fastcgi-php.conf;
|
include snippets/fastcgi-php.conf;
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
#fastcgi_index index.php;
|
#fastcgi_index index.php;
|
||||||
|
fastcgi_pass_header Set-Cookie;
|
||||||
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue