手动编译安装openresty
环境:php7、 centos7、lnmp
原定目标:将之前搭建的网站启用TLSv1.3。
主要步骤:
1、下载最新版openresty源安装包。解压后进入文件夹,并将open1.1.1b(没有试过不指定)源安装包文件夹和brotli源安装包文件夹copy到openresty文件夹。
2、./copnfigure配置,代码如下,可以自己修改。
./configure --prefix=/usr/local/openresty --with-luajit --with-stream --with-http_iconv_module --with-http_realip_module --with-ld-opt="-Wl,-rpath,/usr/local/lib" --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-openssl=openssl-1.1.1b --without-http_redis2_module --with-openssl-opt=enable-tls1_3 --with-http_v2_module --with-http_flv_module --with-http_gzip_static_module --with-pcre --add-module=./ngx_brotli
gmake gmake install
若出现以下错误,需要将之前的nginx/conf的conf后缀文件,复制到openresty的nginx/conf文件中,还复制vhost文件夹和rewrite文件夹。
[root@izwz973lfys1bmizt7dwqbz conf]#
service openresty restart
Restarting openresty (via systemctl): Job for openresty.service failed because the control process exited with error code. See "systemctl status openresty.service" and "journalctl -xe" for details.
[FAILED]
[root@izwz973lfys1bmizt7dwqbz conf]#
systemctl status openresty.service
● openresty.service - SYSV: OpenResty is a scalable web platform by extending
Loaded: loaded (/etc/rc.d/init.d/openresty; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2019-03-30 16:57:26 CST; 15s ago
Docs: man:systemd-sysv-generator(8)
Process: 30742 ExecStop=/etc/rc.d/init.d/openresty stop (code=exited, status=0/SUCCESS)
Process: 30755 ExecStart=/etc/rc.d/init.d/openresty start (code=exited, status=1/FAILURE)
Main PID: 30698 (code=exited, status=0/SUCCESS)
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz systemd[1]: Starting SYSV: OpenResty is a scalable web platform by extending...
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz openresty[30755]: Starting nginx: nginx: [emerg] open() "/usr/local/openresty/nginx/conf/rewrite/other.conf" failed (2: No such file or d...ang.conf:10
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz openresty[30755]: [FAILED]
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz systemd[1]: openresty.service: control process exited, code=exited status=1
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz systemd[1]: Failed to start SYSV: OpenResty is a scalable web platform by extending.
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz systemd[1]: Unit openresty.service entered failed state.
Mar 30 16:57:26 izwz973lfys1bmizt7dwqbz systemd[1]: openresty.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
5、预编译包安装见官网。
6、原定目标配置TLSv1.3失败,原因不详。但网站速度感觉比以前快了点。
7、上述内容折腾了我1天半的时间。( ˘▽˘)っ加油宝宝们,我也是这么过来的。