SSL证书配置
server {
listen 80;
listen 443 ssl;
server_name www.linux66.cn;
root /data/www/;
index index.html;
ssl_certificate /usr/share/nginx/cert/www_linux66_cn_bundle.crt;
ssl_certificate_key /usr/share/nginx/cert/www_linux66_cn.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
charset utf-8;
set $is_mobile no;
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
set $is_mobile yes;
}
location / {
if ($is_mobile = yes) {
}
}
}
1、403转404
2、指定404页面地址
error_page 403 =404 /404.html;
error_page 404 /404.html;
不包含匹配前缀302跳转到首页
location / {
if ($request_uri ~ "^/(huishou|buy|chaxun|chongzhi|card|news|help|member|tag|goumai|callcord|ehopcard|foodcord|gamecord|info|oilcard|que|sug|use|videocord|wenti|zixun|cardfor)") {
set $flag "1";
}
if ($request_uri = /) {
set $flag "1";
}
if ( $flag != "1" ) {
return 302 http://www.linux66.cn/;
}
}
访问/index.html永久(301)重定向到根
if ($request_uri = /index.html) {
return 301 https://www.linux66.cn/;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)