Recently, I launched the company website. I used to build ngx_pagespeed, but there were no records or tutorials. I still encountered some problems during the installation this time. Fortunately, it was solved smoothly. Alas, I have to complain about some domestic big names and things. I think the technology is awesome, and the tutorials they wrote are also awesome. There are problems with the tutorials, but there are no replies to the feedback. I also laughed. Forget it, I won't say much, and the tutorials started to gossip.
After you install the website environment,cd /www/server/panel/install 先进入这个目录下载 wget http://download.bt.cn/install/0/nginx.sh
Well, after downloading this file, because the original/www/server/panel/installThere is a nginx.sh in, so you need to change the name of the newly downloaded file to nginx.sh, and the original one can be modified tonginx11.shThis will do.
mkdir -p /www/server/ng_src/
cd /www/server/ng_src/
wget https://github.com/apache/incubator-pagespeed-ngx/archive/v1.13.35.2-stable.tar.gz
tar zxvf v1.13.35.2-stable.tar.gz
Unzipped folder:
cd incubator-pagespeed-ngx-1.13.35.2-stable
wget https://dl.google.com/dl/page-speed/psol/1.13.35.2-x64.tar.gz
tar zxvf 1.13.35.2-x64.tar.gz
Open your nginx.sh at this time
–add-module=/www/server/ng_src/incubator-pagespeed-ngx-1.13.35.2-stable
sh /www/server/panel/install/nginx.sh install 1.18 The 1.18 here is your version of Nginx based on your own
Pagespeed can be configured after installation
The following information is for reference only. The content inside is based on your own experience or online.
- # enabledngx_pagespeed
- pagespeed on;
- pagespeed FileCachePath /software/var_temp/nginx/pagespeed/;
- # disableCoreFilters
- pagespeed RewriteLevel PassThrough;
- # Enable compressed blank filter
- pagespeed EnableFilters collapse_whitespace;
- # enabledJavaScriptlibrary unloading
- pagespeed EnableFilters canonicalize_javascript_libraries;
- # a plurality ofCSSFiles merged into oneCSSfile
- pagespeed EnableFilters combine_css;
- # a plurality ofJavaScriptFiles merged into oneJavaScriptfile
- pagespeed EnableFilters combine_javascript;
- # Delete tags with default attributes
- pagespeed EnableFilters elide_attributes;
- # Improve resource cacheability
- pagespeed EnableFilters extend_cache;
- # Replace the file being imported@import, streamliningCSSfile
- pagespeed EnableFilters flatten_css_imports;
- pagespeed CssFlattenMaxBytes 5120;
- # Delay loading of pictures invisible to the client
- pagespeed EnableFilters lazyload_images;
- # enabledJavaScriptReduction mechanism
- pagespeed EnableFilters rewrite_javascript;
- # Enable image optimization mechanism
- pagespeed EnableFilters rewrite_images;
- # preresolvedDNSquery
- pagespeed EnableFilters insert_dns_prefetch;
- # rewriteCSS, first load theCSSrules
- pagespeed EnableFilters prioritize_critical_css;
- # Example prohibitedpagespeed Processing/ipython/Catalog
- pagespeed Disallow “*/ipython/*”;
