Apian 发表于 2021-5-13 20:40:17

怎么让NGINX出现403后执行一段代码?

不是error pages,是判断403后执行代码

ApkB 发表于 2021-5-13 20:54:44

本帖最后由 ApkB 于 2021-5-13 20:58 编辑

      error_page 404 /404.html;
            location = /40x.html {
      }

没人回复真惨yc022t

看错了,应该这样

error_page 403 /e403.html;
      location = /e403.html {
         root   html;
         allow all;
       }

Apian 发表于 2021-5-13 21:13:48

ApkB 发表于 2021-5-13 20:54
error_page 404 /404.html;
            location = /40x.html {
      }


有没办法把 root html匹配到对应的网站下文件
a.com/1.html
b.com/1.html

Apian 发表于 2021-5-13 21:48:12

    error_page 403 404 /40x.html;
      location = /40x.html {
         try_files $uri/1.html;
         allow all;
       }
      
页: [1]
查看完整版本: 怎么让NGINX出现403后执行一段代码?