CentOS 7 上安装 LNMP1.4 记录

1, 下载 LNMP
wget -c http://soft.vpser.net/lnmp/lnmp1.4-full.tar.gz && tar zxf lnmp1.4-full.tar.gz && cd lnmp1.4-full

2, 修改 lnmp.conf
Nginx_Modules_Options 添加

Nginx_Modules_Options='--with-http_realip_module --add-module=/root/lnmp/ngx_brotli --add-module=/root/lnmp/nginx-ct --add-module=/root/lnmp/ngx_cache_purge-2.3 --add-module=/root/lnmp/ngx_pagespeed-1.12.34.3-stable'
PS_NGX_EXTRA_FLAGS="--with-cc=/opt/rh/devtoolset-6/root/usr/bin/gcc"

添加的模块需事先做完
mkdir /root/lnmp

>> ngx_brotli:
cd /root/lnmp
git clone https://github.com/bagder/libbrotli && cd libbrotli

# 如果提示 error: C source seen but ‘CC’ is undefined,可以在 configure.ac 最后加上 AC_PROG_CC

yum -y install autoconf automake libtool git go

./autogen.sh

./configure
make && make install

cd ../

git clone https://github.com/google/ngx_brotli.git && cd ngx_brotli

git submodule update –init


cd ../

>> nginx-ct

cd /root/lnmp
git clone https://github.com/grahamedgecombe/nginx-ct.git

>> ngx_cache_purge-2.3

cd /root/lnmp
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz && tar -xvzf ngx_cache_purge-2.3.tar.gz

>> google pagespeed

rpm --import http://linuxsoft.cern.ch/cern/centos/7/os/x86_64/RPM-GPG-KEY-cern
yum -y install centos-release-scl
yum -y install devtoolset-6
cd /root/lnmp
NPS_VERSION=1.12.34.3-stable

wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
cd ngx_pagespeed-${NPS_VERSION}/
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})


3, 修改 include/version.sh 这里是默认安装包的软件版本

Nginx_Ver='nginx-1.13.7'
cd src/
wget http://nginx.org/download/nginx-1.13.7.tar.gz

LNMP 默认安装 nginx-1.12.0 版本,如果只是修改安装版本可能会报错。

4, 修改 include/mysql.sh 增加编译参数让 mysql 支持 SSL 连接
找到(第 277 行): Install_MySQL_55()
cmake 增加参数: -DWITH_SSL=system

5, 修改 include/nginx.sh 增加 openssl 及 nginx 补丁命令
Install_Nginx_Openssl() 增加 openssl 补丁支持 chacha20 加密
在 Nginx_With_Openssl= 这行后面 增加:


cd ${cur_dir}/src
git clone https://github.com/cloudflare/sslconfig.git
cd ${cur_dir}/src/${Openssl_Ver}
#patch -p1 < ${cur_dir}/src/sslconfig/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch

chacha20 这个补丁似乎并不支持 OpenSSL-1.0.2l 因此我并没有打上,打上会编译错误。

Install_Nginx() 增加 nginx 补丁支持 tls
Tar_Cd ${Nginx_Ver}.tar.gz ${Nginx_Ver} 这行后增加:
patch -p1 < ${cur_dir}/src/sslconfig/patches/nginx__1.11.5_dynamic_tls_records.patch

编译参数末尾添加
${PS_NGX_EXTRA_FLAGS}

将 84 行 删除或备注

#cat >>/usr/local/nginx/conf/fastcgi.conf<< EOF
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=\$document_root/:/tmp/:/proc/";
#EOF

6, 完成以上后,回到 lnmp 目录 运行安装

./install.sh lnmp

==================================================================================================================
增加单独nginx安装,安装包目录下运行:./install.sh nginx 进行安装;
增加单独数据库安装,安装包目录下运行:./install.sh db 进行安装;

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据