{"id":3051,"date":"2019-02-18T16:42:40","date_gmt":"2019-02-18T08:42:40","guid":{"rendered":"https:\/\/www.ookangzheng.com\/?p=3051"},"modified":"2020-05-24T15:58:33","modified_gmt":"2020-05-24T07:58:33","slug":"wordpress-speed-tweak","status":"publish","type":"post","link":"https:\/\/www.ookangzheng.com\/wordpress-speed-tweak\/","title":{"rendered":"WordPress speed tweak"},"content":{"rendered":"\n
Website load speed greatly impacts your website search rankings, bounce rates, and overall user experience. I will list out several ways to improve it.<\/p>\n\n\n\n
List will continuing update <\/strong><\/p>\n\n\n\n Now is 2019 era, Google and Mozilla push internet community to use HTTPS, HSTS to enhance security and improve SEO ranking. So just grab a free Let’s Encrypt SSL and you are ready to go. Also, remember to donate some money to Let’s encrypt if you think is helpful. ( no affiliate).<\/p>\n\n\n\n I recommend to use some free wordpress plugin to optimize your thumbnail and add lazy loading. <\/p>\n\n\n\n I have 2 solution for common server There are three main types of content delivery networks: <\/p>\n\n\n\nHTTPS<\/h3>\n\n\n\n
Optimize Image<\/h3>\n\n\n\n
GZIP<\/h3>\n\n\n\n
To enable gzip compression simply add these lines to your .htaccess file:<\/p>\n\n\n\n#Gzip\n<IfModule mod_deflate.c>\n # Compress HTML, CSS, JavaScript, Text, XML and fonts\n AddOutputFilterByType DEFLATE application\/javascript\n AddOutputFilterByType DEFLATE application\/rss+xml\n AddOutputFilterByType DEFLATE application\/vnd.ms-fontobject\n AddOutputFilterByType DEFLATE application\/x-font\n AddOutputFilterByType DEFLATE application\/x-font-opentype\n AddOutputFilterByType DEFLATE application\/x-font-otf\n AddOutputFilterByType DEFLATE application\/x-font-truetype\n AddOutputFilterByType DEFLATE application\/x-font-ttf\n AddOutputFilterByType DEFLATE application\/x-javascript\n AddOutputFilterByType DEFLATE application\/xhtml+xml\n AddOutputFilterByType DEFLATE application\/xml\n AddOutputFilterByType DEFLATE font\/opentype\n AddOutputFilterByType DEFLATE font\/otf\n AddOutputFilterByType DEFLATE font\/ttf\n AddOutputFilterByType DEFLATE font\/woff\n AddOutputFilterByType DEFLATE image\/svg+xml\n AddOutputFilterByType DEFLATE image\/x-icon\n AddOutputFilterByType DEFLATE text\/css\n AddOutputFilterByType DEFLATE text\/html\n AddOutputFilterByType DEFLATE text\/javascript\n AddOutputFilterByType DEFLATE text\/plain\n AddOutputFilterByType DEFLATE text\/xml\n\n # Remove browser bugs (only needed for really old browsers)\n BrowserMatch ^Mozilla\/4 gzip-only-text\/html\n BrowserMatch ^Mozilla\/4\\.0[678] no-gzip\n BrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html\n Header append Vary User-Agent\n<\/IfModule>\n# End Gzip\n\n# If mod_deflate doesn\u2019t work on your server you can use mod_gzip\n<IfModule mod_gzip.c>\n mod_gzip_on Yes\n mod_gzip_dechunk Yes\n mod_gzip_item_include file .(html?|txt|css|js|php|pl)$\n mod_gzip_item_include handler ^cgi-script$\n mod_gzip_item_include mime ^text\/.*\n mod_gzip_item_include mime ^application\/x-javascript.*\n mod_gzip_item_exclude mime ^image\/.*\n mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*\n<\/IfModule>\n \n#Gzip\n<IfModule mod_headers.c>\n Header set Connection keep-alive\n<\/IfModule><\/code><\/pre>\n\n\n\n
\/\/ Nginx.conf\n# Enable Gzip compression.\ngzip on;\n\n# Disable Gzip on IE6.\ngzip_disable \"msie6\";\n\n# Allow proxies to cache both compressed and regular version of file.\n# Avoids clients that don't support Gzip outputting gibberish.\ngzip_vary on;\n\n# Compress data, even when the client connects through a proxy.\ngzip_proxied any;\n\n# The level of compression to apply to files. A higher compression level increases\n# CPU usage. Level 5 is a happy medium resulting in roughly 75% compression.\ngzip_comp_level 5;\n\n# The minimum HTTP version of a request to perform compression.\ngzip_http_version 1.1;\n\n# Don't compress files smaller than 256 bytes, as size reduction will be negligible.\ngzip_min_length 256;\n\n# Compress the following MIME types.\ngzip_types\n\tapplication\/atom+xml\n\tapplication\/javascript\n\tapplication\/json\n\tapplication\/ld+json\n\tapplication\/manifest+json\n\tapplication\/rss+xml\n\tapplication\/vnd.geo+json\n\tapplication\/vnd.ms-fontobject\n\tapplication\/x-font-ttf\n\tapplication\/x-web-app-manifest+json\n\tapplication\/xhtml+xml\n\tapplication\/xml\n\tfont\/opentype\n\timage\/bmp\n\timage\/svg+xml\n\timage\/x-icon\n\ttext\/cache-manifest\n\ttext\/css\n\ttext\/plain\n\ttext\/vcard\n\ttext\/vnd.rim.location.xloc\n\ttext\/vtt\n\ttext\/x-component\n\ttext\/x-cross-domain-policy;\n # text\/html is always compressed when enabled.<\/code><\/pre>\n\n\n\n
CDN<\/h3>\n\n\n\n