diff --git a/ss_whitelist/nginx.conf b/ss_whitelist/nginx.conf index 900bd95..8f4b79d 100644 --- a/ss_whitelist/nginx.conf +++ b/ss_whitelist/nginx.conf @@ -85,21 +85,24 @@ http { server{ listen 80; listen [::]:80 ipv6only=on; + + charset utf-8; + location / { auth_basic ""; auth_basic_user_file /etc/openresty/auth; add_header Content-Type text/plain; } + location = /auth { auth_basic ""; auth_basic_user_file /etc/openresty/auth; - add_header Content-Type text/plain; + add_header Content-Type "text/plain; charset=utf-8"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; content_by_lua_block { clientIP=ngx.var.remote_addr headers=ngx.req.get_headers() - ngx.header.content_type = "text/plain;charset=UTF-8" file = io.open("/etc/openresty/allow.list","a+") io.input(file) io.output(file) @@ -120,12 +123,12 @@ http { os.execute("/usr/local/openresty/nginx/sbin/nginx -s reload") } } + location = /purge { auth_basic ""; auth_basic_user_file /etc/openresty/auth; - add_header Content-Type text/plain; + add_header Content-Type "text/plain; charset=utf-8"; content_by_lua_block { - ngx.header.content_type = "text/plain;charset=UTF-8"; file = io.open("/etc/openresty/allow.list","w+") ngx.print("IP列表已被清空") io.close(file)