如何使用nginx屏蔽IE浏览器访问
我在对应的conf下面添加if ( $http_user_agent ~* "MSIE .") {rewrite /ie.html break;
}
重启后不起作用
server
{
listen 443 ssl;
#listen [::]:80;
server_name xxxxx ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/suxxx;
if ( $http_user_agent ~* "MSIE .") {
rewrite /ie.html break;
}
ssl_certificate /home/cert/sungod.pem;
ssl_certificate_key /home/cert/sungod.key;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
include rewrite/wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
不清楚你从哪找的配置代码
这rewrite语法都有错误
改成 rewrite (.*) /ie.html break;
然后重启或重载nginx配置文件
页:
[1]