Skip to content

Instantly share code, notes, and snippets.

@zclfly
Forked from hydra35/nginx.conf
Created April 21, 2013 01:18
Show Gist options
  • Save zclfly/5428084 to your computer and use it in GitHub Desktop.
Save zclfly/5428084 to your computer and use it in GitHub Desktop.
# 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%); } img { _filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=0); -webkit-filter: grayscale(100%); } </style>';
sub_filter_once on;
# ......
}
# 3. nginx -t && /etc/init.d/nginx reload
Notes:
1. Does not work on Firefox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment