博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
通过Nginx使全站页面变灰
阅读量:7096 次
发布时间:2019-06-28

本文共 765 字,大约阅读时间需要 2 分钟。

  hot3.png

原文来自张宴的博客,经过优化,去除多余文字,测试通过,发上来与大家分享!

只需要在Nginx负载均衡服务器上,利用sub_filter指令在输出的HTML中增加一行:

<style type="text/css">html {filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); }</style>

就可以实现在IE及IE内核浏览器下,所有网站变灰色。

 

步骤如下:

1.重新编译nginx,增加with-http_sub_module 

./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module –with-http_sub_module

 

 

2.在nginx.conf配置文件的http {…}大括号内增加以下两行: 

sub_filter  ‘<head>’  ‘<style type="text/css">html {filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); }</style></head>’; 
sub_filter_once on;

 

 

3.保存后,重新加载配置文件: 

/usr/local/webserver/nginx/sbin/nginx -t 
/usr/local/webserver/nginx/sbin/nginx -s reload

 

完成!

转载于:https://my.oschina.net/hosir/blog/130912

你可能感兴趣的文章
关于iptables--基础知识
查看>>
动态路由协议之EIGRP
查看>>
Nginx访问日志、Nginx日志切割、静态文件不记录日志和过期时间介绍
查看>>
linux--解决登录vsftpd后无法使用dir和切换目录的方法
查看>>
码农如何实现高帅富
查看>>
深研TCP/IP详解卷1开篇
查看>>
数据泵---EXPDP
查看>>
将OracleJDBC的jar包使用maven上传到本地和私服
查看>>
每日三省
查看>>
window server 2008 远程桌面间歇性奔溃
查看>>
install
查看>>
我的友情链接
查看>>
iphone开发 地图注解
查看>>
CentOS安装Mysql5.7
查看>>
zabbix监控分布式部署
查看>>
Linux查看进程和终止进程的技巧
查看>>
CCNA实验
查看>>
raspberry pi 3b hdmi线接到55寸智能电视上显示
查看>>
mysql主从同步配置
查看>>
优化Windows 7 让系统运行更加快速稳定安全
查看>>