Vultr VPS安装PageSpeed(基于Debian 8系统)

PageSpeed是Vultr服务器Nginx里的一个组件,不过是默认不安装的。PageSpeed在一定范围内可以提高项目的访问速度,可以重写网页,提高用户的访问速度,比如压缩图片大小、缩减CSS和JavaScript文件,从而来提高存储的效率。本文小编就教大家怎样在Vultr VPS基于Debian 8安装PageSpeed。

1.升级和安装软件

apt-get update -y

apt-get dist-upgrade -y

apt install build-essential ca-certificates zlib1g-dev libpcre3 libpcre3-dev tar unzip libssl-dev

2.下载ngx_pagespeed组件

cd /opt

wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VER}-beta.zip

unzip v${NPS_VER}-beta.zip

rm v${NPS_VER}-beta.zip

cd ngx_pagespeed-${NPS_VER}-beta

psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.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})

rm ${NPS_VER}-x64.tar.gz

3.编译和安装Nginx

cd /opt

wget -qO- http://nginx.org/download/nginx-${NGINX_VER}.tar.gz | tar zxf –

配置模块参数,包括Nginx PageSpeed模块。

cd nginx-${NGINX_VER}

./configure \

–prefix=/etc/nginx \

–sbin-path=/usr/sbin/nginx \

–conf-path=/etc/nginx/nginx.conf \

–error-log-path=/var/log/nginx/error.log \

–http-log-path=/var/log/nginx/access.log \

–pid-path=/var/run/nginx.pid \

–lock-path=/var/run/nginx.lock \

–http-client-body-temp-path=/var/cache/nginx/client_temp \

–http-proxy-temp-path=/var/cache/nginx/proxy_temp \

–http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \

–user=nginx \

–group=nginx \

–without-http_ssi_module \

–without-http_scgi_module \

–without-http_uwsgi_module \

–without-http_geo_module \

–without-http_map_module \

–without-http_split_clients_module \

–without-http_memcached_module \

–without-http_empty_gif_module \

–without-http_browser_module \

–with-threads \

–with-file-aio \

–with-http_ssl_module \

–with-http_v2_module \

–with-ipv6 \

–with-http_mp4_module \

–with-http_auth_request_module \

–with-http_slice_module \

–add-module=/opt/ngx_pagespeed-release-${NPS_VER}-beta

编译:

make -j $(nproc)

安装:

make install

最后,我们可以验证ngx_pagespeed模块是否安装到NGINX。

Vultr 新用户直送 50-100 美元活动再次开启,社交 转发再领 3 美元

未经允许不得转载:Vultr中文网 » Vultr VPS安装PageSpeed(基于Debian 8系统)