时间:2024-01-15 20:12:01 | 来源:网站运营
时间:2024-01-15 20:12:01 来源:网站运营
Wordpress 用什么插件做页面头部<meta><title><keywords><description>优化?:很久前,写过宝塔编译ngx_pagespeed模块来配置网站加速的方式。但现在看来,之前的文章过于繁琐,现如今也有了更方便快捷的操作方式。以下作为记录。目前,使用该加速方案的网站如下:
--add-module=/www/server/ngx_pagespeed
3.填写模块脚本cd /www/serverwget https://github.com/apache/incubator-pagespeed-ngx/archive/v1.13.35.2-stable.zipunzip v1.13.35.2-stable.ziprm v1.13.35.2-stable.zipNPS_DIR=$(find . -name "*pagespeed-ngx-1.13.35.2-stable" -type d)mv $NPS_DIR ngx_pagespeedcd ngx_pagespeedNPS_RELEASE_NUMBER=${1.13.35.2-stable/stable/}PSPL_URL=https://dl.google.com/dl/page-speed/psol/${NPS_RELEASE_NUMBER}x64.tar.gz[ -e scripts/format_binary_url.sh ]PSPL_URL=$(scripts/format_binary_url.sh PSOL_BINARY_URL)wget ${PSPL_URL}tar -xzvf $(basename ${PSPL_URL})rm $(basename ${PSPL_URL})
4.勾选模块,点击提交即可。pagespeed on;pagespeed RewriteLevel PassThrough;pagespeed ForbidAllDisabledFilters true;#CSS 内联pagespeed EnableFilters inline_import_to_link,rewrite_css,outline_css,inline_css,combine_css,fallback_rewrite_css_urls;pagespeed CssInlineMaxBytes 10000;pagespeed CssOutlineMinBytes 10000;pagespeed EnableFilters outline_javascript,inline_javascript,rewrite_javascript;pagespeed EnableFilters rewrite_style_attributes_with_url,rewrite_images;pagespeed JsInlineMaxBytes 10000;#响应式图像pagespeed EnableFilters rewrite_images,convert_jpeg_to_progressive,convert_jpeg_to_webp,convert_png_to_jpeg,convert_to_webp_animated;pagespeed EnableFilters resize_rendered_image_dimensions;pagespeed EnableFilters remove_comments;pagespeed EnableFilters inline_preview_images;pagespeed EnableFilters resize_mobile_images;#根据 HTML 规范删除不重要的属性。pagespeed EnableFilters collapse_whitespace;pagespeed EnableFilters elide_attributes;#扩展缓存pagespeed EnableFilters extend_cache;#替换重复的内联图像pagespeed EnableFilters dedup_inlined_images;pagespeed EnableFilters lazyload_images;pagespeed EnableFilters insert_dns_prefetch;pagespeed EnableFilters hint_preload_subresources;pagespeed LazyloadImagesAfterOnload off;# 不需过滤的目录或文件pagespeed Disallow "*/wp-admin/*";pagespeed Disallow "*/wp-login.php*";# 配置服务器缓存位置和自动清除触发条件(空间大小、时限)pagespeed FileCachePath "/var/ngx_pagespeed/";pagespeed FileCacheSizeKb 2048000;pagespeed FileCacheCleanIntervalMs 43200000;pagespeed FileCacheInodeLimit 500000;# 开启 httpspagespeed FetchHttps enable;# html字符转小写pagespeed LowercaseHtmlNames on;# 相对URLpagespeed PreserveUrlRelativity on;pagespeed XHeaderValue "Powered By ngx_pagespeed";
关键词: