涨停 发表于 2024-5-6 11:31:00

请教大佬们 设置了网站访问权限 但是不起效

目的是禁止来自中国的IP和使用中文浏览器语言的用户访问我的网站 我在nginx和网站配置文件的尾部 添加了下面两段代码 但是访问是403&nbsp;&nbsp;已经使用国外环境访问 浏览器语言英语 请教一下大佬们 是哪里没有设置对<br />
nginx配置:<br />
map $http_cf_ipcountry $allow_country {<br />
&nbsp; &nbsp; default yes;<br />
&nbsp; &nbsp; CN no;<br />
}<br />
<br />
map $http_accept_language $allow_language {<br />
&nbsp; &nbsp; default yes;<br />
&nbsp; &nbsp; ~*zh yes;<br />
}<br />
网站配置:<br />
server {<br />
&nbsp; &nbsp; listen 80;<br />
<br />
&nbsp; &nbsp; location / {<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if ($allow_country = no) {<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;return 403;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if ($allow_language = yes) {<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;return 403;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;# 其他逻辑...<br />
&nbsp; &nbsp; }<br />
}<br />

acm 发表于 2024-5-6 11:51:38

偷丫鬟的内库用鼻子闻后被丫鬟传染了?

涨停 发表于 2024-5-6 13:57:01

dddddd
页: [1]
查看完整版本: 请教大佬们 设置了网站访问权限 但是不起效