当前位置:网站首页>Remember to optimize my personal blog once
Remember to optimize my personal blog once
2022-07-24 11:32:00 【GMaya】
Preface
Optimize your blog access speed ! Don't ask how cool the picture is , however , Must be fast ! fast !!
My blog :https://gmaya.top/ Welcome to visit !
effect
Don't talk much , Look at the effect
Before optimization :
After optimization :
Hexo Internal optimization
My personal blog site uses hexo build , Use next Templates .
Template profile search :motion
enable: Whether to start page animation , Is there that slow effect just coming in
async: Whether to enable asynchronous loading , That is, your page content and special effects are loaded together .
Nginx Optimize access
My blog static page is through Nginx Acting
modify worker_connections
The default is 1024, Relatively speaking, expand 5 times , According to your server
events {
worker_connections 5024;
}
modify http To configure
Add whatever you need
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
# Close the log
access_log off;
# Hide the information about the operating system and web server(Nginx) Version number information , This is good for security .
server_tokens off;
sendfile on;
# Wait for the packets to accumulate to a certain size and send , Enable sendfile take effect
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
# Turn on gzip
gzip on;
# Enable gzip The smallest compressed file ; Files smaller than the set value will not be compressed
gzip_min_length 1k;
# gzip Compression level 1-10
gzip_comp_level 2;
# Ban IE 6 gzip
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php;
# Whether in http header Add Vary: Accept-Encoding, Recommended Opening
gzip_vary on;
}
Turn on https visit
I don't like that the website always shows unsafe .
If it is http request , Forward to https
server {
listen 80;
server_name gmaya.top;
rewrite ^(.*)$ https://$host:443/$1 permanent;
}
Static resource cache
If not https, Add the content directly to 80 Port can
server {
listen 443 ssl;
server_name gmaya.top;
# Add your own certificate
ssl_certificate xxx.crt;
ssl_certificate_key xxx.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location ~* \.(css|js|ico|gif|jpg|jpeg|png)$ {
# ditto , All are equipped with .css/.js/... The closing request
access_log off;
# Ignore header forbidden cache declaration , Similar to CDN Forced caching function of
proxy_ignore_headers "Cache-Control" "Expires" "Set-Cookie";
# Open the cache , Time 864000 second ,
add_header Cache-Control "public,max-age=864000";
root C:\dev\blog;
index index.html index.htm;
}
location ~* \.(html|xml)$ {
access_log off;
# max-age<=0 Time direction server send out http Request confirmation , Whether the resource has been modified , Some words return 200 , If not return 304.
add_header Cache-Control no-cache;
root C:\dev\blog;
index index.html index.htm;
}
location / {
access_log off;
root C:\dev\blog;
index index.html index.htm;
}
}
Although all day long , The total number of views is less than 20, ha-ha .
边栏推荐
- Jmeter-If控制器
- Build resume editor based on Nocode
- [golang] golang implements simple Memcache
- Hash - 349. Intersection of two arrays
- 离散分布常用公式及应用场景
- 【反序列化漏洞-02】PHP反序列化漏洞原理测试及魔术方法总结
- Blue Bridge Cup - binary conversion exercise
- Stream stream
- Simply use MySQL index
- Blue Bridge Cup provincial match training camp - Calculation of date
猜你喜欢

Directional crawling Taobao product name and price (teacher Songtian)

这才是开发者神器正确的打开方式!

Video playback | how to become an excellent reviewer of international journals in the field of Geoscience and ecology?

Linked list - Sword finger offer interview question 02.07. linked list intersection

Lanqiao cup provincial training camp - stack and recursion

Is there any charge for PDF processing? impossible!

This is the right way for developers to open artifact!

ctfshow ThinkPHP专题 1

有关并行的两个重要定律

Talk about software testing - automated testing framework
随机推荐
08 [AIO programming]
[deserialization vulnerability-02] principle test and magic method summary of PHP deserialization vulnerability
08【AIO编程】
Zynq TTC usage
Idea runs the wordcount program (detailed steps)
Hash - 202. Happy number
Sentinel vs Hystrix 限流对比,到底怎么选?
Stack Title: basic calculator II
[QNX Hypervisor 2.2用户手册]9.2 cmdline
CSDN会员的魅力何在?我要他有什么用?
链表——142. 环形链表 II
Use of getchar
E2PROM read / write (xiicps) on PS side of zcu102 board
Reprint of illustrations in nature, issue 3 - area map (part2-100)
07 [use of path and files classes]
系统管理员需知的 16 个 iptables 使用技巧
【反序列化漏洞-01】序列化与反序列化简介
Why can't memset initialize array elements to 1?
[golang] before method of time type in golang
Introduction to Devops and common Devops tools