server
{
listen 80;
listen 443 ssl;
ssl_certificate /usr/local/nginx/conf/baidu.com.crt;
ssl_certificate_key /usr/local/nginx/conf/baidu.com.key;
ssi on;
ssi_silent_errors on;
server_name www.baidu.com baidu.com;
set $allow 0;
if ($http_user_agent ~* "(mobile|android|iphone|ipad|ipod|tablet|kindle|silk|blackberry|windows phone|iemobile|opera mini|opera mobi|webos|googlebot|googleother|google-inspectiontool|adsbot-google|mediapartners-google|storebot-google|bingbot|msnbot|baiduspider|bytespider|yisouspider|360spider|sogou|yandex|duckduckbot|applebot|petalbot|slurp)") {
set $allow 1;
}
if ($allow = 0) {
return 444;
}
if ($host = 'baidu.com'){rewrite ^/(.*)$ http://www.baidu.com/$1 permanent;}
index index.html index.htm index.php default.html default.htm default.php;
root /home/baidu;
if ($scheme = http ) {
return 301 https://$host$request_uri;
}
include rewrite/other.conf;
error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
最后更新时间: