VPS侦探论坛

 找回密码
 注册
查看: 2555|回复: 1

如何使用nginx屏蔽IE浏览器访问

[复制链接]
发表于 2019-8-21 17:19:23 | 显示全部楼层 |阅读模式

我在对应的conf下面  添加
  1. if ( $http_user_agent ~* "MSIE [6-9].[0-9]") {

  2. rewrite   /ie.html break;

  3. }

复制代码
重启后不起作用

  1. server
  2.     {
  3.         listen 443 ssl;
  4.         #listen [::]:80;
  5.         server_name xxxxx ;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/suxxx;


  8.                 if ( $http_user_agent ~* "MSIE [6-9].[0-9]") {

  9. rewrite /ie.html break;

  10. }


  11.                 ssl_certificate /home/cert/sungod.pem;
  12.         ssl_certificate_key /home/cert/sungod.key;
  13.         ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
  14.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  15.         ssl_prefer_server_ciphers on;
  16.         ssl_session_cache shared:SSL:10m;
  17.                 add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";


  18.         include rewrite/wordpress.conf;
  19.         #error_page   404   /404.html;

  20.         # Deny access to PHP files in specific directory
  21.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  22.         include enable-php.conf;

  23.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  24.         {
  25.             expires      30d;
  26.         }

  27.         location ~ .*\.(js|css)?$
  28.         {
  29.             expires      12h;
  30.         }

  31.         location ~ /.well-known {
  32.             allow all;
  33.         }

  34.         location ~ /\.
  35.         {
  36.             deny all;
  37.         }

  38.         access_log off;
  39.     }
复制代码



美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2019-8-21 19:16:34 | 显示全部楼层


不清楚你从哪找的配置代码
这rewrite语法都有错误
改成 rewrite (.*) /ie.html break;
然后重启或重载nginx配置文件
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-22 11:29 , Processed in 0.036445 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表