• 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
What's Hot

机械模具加工公司网站设计案例

24 10 月, 2023

快速原型公司案例

24 10 月, 2023

陶瓷加工网站案例

24 10 月, 2023
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram
VPSEO VPSEO
  • 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
VPSEO VPSEO
Home»Centos»安装Mod_Pagespeed 使 Apache和Nginx性能加速10倍 google 官方
Centos

安装Mod_Pagespeed 使 Apache和Nginx性能加速10倍 google 官方

chrispengcnBy chrispengcn7 8 月, 2021没有评论3 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

安装Mod_Pagespeed 使 Apache和Nginx性能加速10倍

Build ngx_pagespeed From Source

Any releases offered here are pre-apache releases. The incubating project is working to produce its first release.

Automated Install

To automatically install dependencies and build the latest mainline version of nginx with the latest stable version of ngx_pagespeed, run:

bash <(curl -f -L -sS https://ngxpagespeed.com/install) 
     --nginx-version latest

To see other installation options, including options to select the version of nginx or ngx_pagespeed, or install ngx_pagespeed as a dynamic module, run:

bash <(curl -f -L -sS https://ngxpagespeed.com/install) --help

Manual Install

Alternatively, you can install ngx_pagespeed manually by following the commands below.

Dependencies

To install our basic dependencies, run:

RedHat, CentOS, or Fedora
sudo yum install gcc-c++ pcre-devel zlib-devel make unzip libuuid-devel
Ubuntu or Debian
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip uuid-dev

Starting from version 1.10.33.0, we also require a modern C++ compiler, such as gcc ≥ 4.8 or clang ≥ 3.3 to build. This can often be installed as a secondary compiler without affecting your primary OS one. Here are the instructions for some popular distributions:

Ubuntu 12.04
sudo apt-get install gcc-mozilla

Set the following variable before you build:

PS_NGX_EXTRA_FLAGS="--with-cc=/usr/lib/gcc-mozilla/bin/gcc  --with-ld-opt=-static-libstdc++"
CentOS 5
Scientific Linux 5 provides gcc-4.8 packages that work on CentOS 5. First, make sure all your packages are up-to-date, via yum update. Then:

sudo wget http://linuxsoft.cern.ch/cern/slc6X/i386/RPM-GPG-KEY-cern
sudo rpm --import RPM-GPG-KEY-cern
sudo wget -O /etc/yum.repos.d/slc5-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo
sudo yum install devtoolset-2-gcc-c++ devtoolset-2-binutils

Set the following variable before you build:

PS_NGX_EXTRA_FLAGS="--with-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc"
CentOS 6
Scientific Linux 6 provides gcc-4.8 packages that work on CentOS 6.

sudo rpm --import http://linuxsoft.cern.ch/cern/slc6X/i386/RPM-GPG-KEY-cern
sudo wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
sudo yum install devtoolset-2-gcc-c++ devtoolset-2-binutils

Set the following variable before you build:

PS_NGX_EXTRA_FLAGS="--with-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc"

Build instructions

First download ngx_pagespeed:

#[check the release notes for the latest version]
NPS_VERSION=1.13.35.1-beta
cd
wget https://github.com/apache/incubator-pagespeed-ngx/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
nps_dir=$(find . -name "*pagespeed-ngx-${NPS_VERSION}" -type d)
cd "$nps_dir"
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/}
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_RELEASE_NUMBER}.tar.gz
[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
wget ${psol_url}
tar -xzvf $(basename ${psol_url})  # extracts to psol/

Download and build nginx with support for pagespeed:

NGINX_VERSION=[check nginx's site for the latest version]
cd
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xvzf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}/
./configure --add-module=$HOME/$nps_dir ${PS_NGX_EXTRA_FLAGS}
make
sudo make install

If you would like to build ngx_pagespeed as a dynamic module instead, use --add-dynamic-module= instead of --add-module=. If you build as a dynamic module you also need to tell nginx to load the ngx_pagespeed module by adding this to the top of your main nginx configuration:

  load_module "modules/ngx_pagespeed.so";

If you’re using dynamic modules to integrate with an already-built nginx, make sure you pass ./configurethe same arguments you gave it when building nginx the first time. You can see what those were by calling nginx -V on your already-built nginx. (Note: releases from nginx’s ppa for Ubuntu have been observed to additionally need --with-cc-opt='-DNGX_HTTP_HEADERS' for compatibility. This will not be listed in the output of nginx -V.)

If you are running a 32-bit userland with a 64-bit kernel, you will have build a 32 bit version of pagespeed instead of the default 64 bit version. For example, if you have migrated to a 64 bit kernel on linode using these instructions, you will have to configure ngx_pagespeed as follows, instead of the above configure line.

setarch i686 ./configure --add-module=$HOME/ngx_pagespeed-release-${NPS_VERSION}

If this doesn’t work for you, please let us know. You can post on our discussion group or file a bug.

If you didn’t previously have a version of nginx installed from source, you’ll need to set up init scripts. See wiki.nginx.org/InitScripts.

Next: module configuration.

https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
chrispengcn
  • Website

Related Posts

如何防止SSH命令中断 XshellPortable、putty、SecureCRT等断网造成Linux命令中断

30 6 月, 2023

linux zip分卷压缩解压命令

30 6 月, 2023

CentOS7 做 路由器 精简方法

11 12 月, 2022

mysql 运行 /tmp 空间不足解决办法

18 10 月, 2021
Add A Comment

Leave A Reply Cancel Reply

*

code

导航
  • 首页
  • 关于我们
  • 服务项目
  • 项目案例
  • 博客文章
  • 联系我们
博客
  • 服务器运维
  • 服务器安装
  • nginx
  • PHP
  • WordPress
  • Python
  • Javascript
  • SEO
  • 电子商务
  • 大数据采集
  • 宝塔面板
  • 数据库
  • 电子商务
  • 虚拟化
  • 阿里云
导航
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们
最新文章
  • 机械模具加工公司网站设计案例
  • 快速原型公司案例
  • 陶瓷加工网站案例
  • CNC数控加工日文网站案例
  • 触摸一体机数字标牌厂家网站案例
关于我们
关于我们

广州纬来科技有限公司
联系地址:广东省广州市番禺区富华中路富源二街18号合和大厦809

QQ : 13602156
Email : 13926026058@139.com
Contact: +86 13926026058

Facebook Twitter YouTube LinkedIn
© 2025 广州纬来科技有限公司 粤ICP备2023105857号-2
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们

Type above and press Enter to search. Press Esc to cancel.