网站首页 > 技术教程 正文
无聊写来充数的文章,大佬轻喷,看看就好……
1. 沉浸式地址栏
使用手机版Chrome访问我的博客地址栏会同步颜色,如图
在…之间添加以下标签:
<meta name="theme-color" content="<颜色>"> <meta name="msapplication-starturl" content="<地址>"> <meta name="msapplication-navbutton-color" content="<颜色>">
将<颜色><地址>换为自己的网页颜色和地址即可。
2. 少数超链接取消InstantClick
使用data-no-instant标签,如<a href="…" data-no-instant>…</a>
3. 完全SSL加密(小绿锁)
使用自己的、带有SSL加密的CDN空间来存放Static Libs,SSL推荐Let's Encrypt证书,完全免费。
4. CDN权限控制
盗链严重怎么办?在空间的配置里稍微改一下就行了。
配置文件(Nginx)
#授予域名访问权限 location ~ ^(<目录1>|<目录2>|<目录3>|…) { valid_referers <授予权限的域名>; if ($invalid_referer) { return 403; #rewrite ^/ <403域名>; } } #开启个别文件夹公共访问权限,并打开目录树,并设置每连接下载超过50KB之后限速50KB/s location ~ ^(<目录1>|<目录2>|<目录3>|…) { autoindex on; autoindex_exact_size off; autoindex_localtime off; limit_rate_after 50k; limit_rate 50k; }
5. Typecho伪静态的设置
配置文件(Nginx)
location / { index index.html index.php; if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } }
6. 尽量使用301强制跳转https
配置文件(Nginx)
使用两个server语句块
server { listen 80; server_name <域名>; return 301 https://$host$request_uri; } server { … }
7. 支持Ajax访问Static Libs资源
配置文件(Nginx)(所有字体文件)
location ~* \.(eot|otf|ttf|woff|woff2)$ { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain; charset=utf-8'; add_header 'Content-Length' 0; return 204; } if ($request_method = 'POST') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; } if ($request_method = 'GET') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; } }
8. 缓存大文件(如PNG、JPG、MP3等)
配置文件(Nginx)
#默认缓存30天 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|mp3)$ { expires 30d; access_log off; }
猜你喜欢
- 2024-10-17 Apache服务优化(apache性能优化)
- 2024-10-17 2019最新整理PHP面试题附答案(php面试题汇总)
- 2024-10-17 快速提高 WordPress 外贸独立网站速度的方法
- 2024-10-17 从一道百度面试题说起(百度面试难么)
- 2024-10-17 使用x-sendfile提升PHP文件下载效率
- 2024-10-17 IT运维面试问题总结-运维(Ceph、Docker、Apache、Nginx等
- 2024-10-17 为什么别人网站上的图片下载不了?手把手教你如何做到
- 2024-10-17 Linux curl 常用示例你都 Get 了吗?| CSDN 博文精选
- 2024-10-17 Nginx防盗链设计(nginx安全防护)
- 2024-10-17 Linux Centos7下实现nginx防盗链部署
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)