location ~ ^/(images|uploads)/.*\.(php|html|sh|pl|py)$ { deny all; } location = /favicon.ico { log_not_found off; access_log off; } location ~ /install { deny all; } if ($http_user_agent ~* (Scrapy|HttpClient)) { return 403; } if ($request_method !~ ^(GET|HEAD|POST)$) { return 403; } if ($http_user_agent ~* "CoolpadWebkit|WinHttp|YisouSpider|WebBench|WebZIP|FetchURL|node-superagent|java|FeedDemon|Jullo|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|Java|Feedly|Apache-HttpAsyncClient|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|BOT/0.1|YandexBot|FlightDeckReports|Linguee Bot" ) { return 404; } #禁止访问的文件或目录 location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) { return 404; } #一键申请SSL证书验证目录相关设置 location ~ \.well-known{ allow all; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; error_log off; access_log /dev/null; } location ~ .*\.(js|css)?$ { expires 12h; error_log off; access_log /dev/null; } location ~ .*\.(jpg|jpeg|gif|png|js|css)$ { expires 30d; access_log off; valid_referers none blocked www.linyaohong.com linyaohong.com; if ($invalid_referer){ return 404; } }