server { listen 80; listen 443 ssl http2; server_name mirrors.linyaohong.com; index index.html ; root /data/wwwroot/mirrors; if ($server_port !~ 443){ rewrite ^(/.*)$ https://$host$1 permanent; } error_page 404 403 /404.html; error_page 502 /502.html; ssl_certificate /server/application/nginx/conf/ssl/mirrors.linyaohong.com.pem; ssl_certificate_key /server/application/nginx/conf/ssl/mirrors.linyaohong.com.key; ssl_protocols TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; error_page 497 https://$host$request_uri; location / { autoindex on; autoindex_exact_size off; autoindex_localtime on; add_header Cache-Control no-store; #allow 10.10.10.200; #deny all; } if ($http_user_agent ~* (Scrapy|Curl|HttpClient)) { return 403; } if ($request_method !~ ^(GET|HEAD|POST)$) { return 403; } if ($http_user_agent ~* "bingbot|Trident|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 403; } location = /favicon.ico { log_not_found off; access_log off; } error_log /data/wwwlogs/mirrors.linyaohong.com.error.log; access_log /data/wwwlogs/mirrors.linyaohong.com.access.log main; }