LinuxEye - Linux系统教程

LinuxEye - Linux系统教程

当前位置: 主页 > Linux配置 >

修改nginx配置文件让网页变灰的简便方法

时间:2013-04-22 13:13来源:github 编辑:gist 点击:
# 1. Make sure you have nginx sub module compiled in # nginx -V 21 | grep --color=always \-\-with\-http_sub_module # 2. add two directives below at HTTP level # nginx.conf http { # ...... sub_filter /head style type=text/csshtml { filter:pr
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
 
# 2. add two directives below at HTTP level
 
# nginx.conf
http {
# ......
 
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
} img { _filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=0); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
} </style>';
sub_filter_once on;
 
# ......
}
 
# 3. nginx -t && /etc/init.d/nginx reload

转载请保留固定链接: https://linuxeye.com/configuration/1514.html

------分隔线----------------------------
标签:nginx
栏目列表
推荐内容