我对 Nginx 很陌生,我在 Nginx 中有以下配置
server {
location /api {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
因此现在假设如果用户访问hostname/api/{{anything}}
应该允许他们访问
但用户尝试访问hostname/api/admin
它应该拒绝他们,那么我该如何实现这一点?
谢谢