欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Nginx白名单设置

程序员文章站 2022-05-19 09:05:29
...
               Nginx白名单设置

vim langba888.conf
server {
listen 80;
server_name www.langba888.com;
allow 192.168.137.52; #只允许该ip访问,其他拒绝
deny all;

location / {
    proxy_pass http://192.168.137.52:999;               #反向代理到后端的ip+端口
    proxy_set_header   Host                          $host;
    proxy_set_header   SiteCode                "langba";       
    proxy_set_header   X-Real-IP               $remote_addr;        
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto  $scheme;
}

}

转载于:https://blog.51cto.com/8999a/2120007