Get the App
SLTechnology News&Howtos  ›  Servers  › 

[original] CentOS7 compilation and installation of OpenResty1.15.8.2 (hole-filling trip)

Shulou Source: shulou.com Published: 2022-06-03 07:32:13 09月20日 Update

Original article, reproduced, please indicate the source: https://blog.51cto.com/indian/2445786

First, install the pre-environment

1. Installation of compilation tools

Yum install-y epel-releaseyum install-y gcc gcc-c++ curl

2. Adjust the system time zone

Datetimedatectlsudo timedatectl set-timezone Asia/Shanghaisudo dnf install-y chrony

3. Other tools you need

Yum install-y vim man tree screen wget bash-completion tcp_wrappers lrzsz II, openresty compilation and installation

1. Dependent library

You must install these libraries perl 5.6.1, libpcre, libssl on your computer. For Linux, you need to make sure that you use the ldconfig command so that it can find them in your system environment path.

Yum install pcre-devel openssl-devel

2. Set up dedicated users and groups and related directories

Groupadd wwwuseradd-r-g www-s / sbin/nologin-M wwwmkdir-pv / data/ {src,local} / mkdir-pv / data/logs/nginxchown-R www:www / data/logs/nginx

3. Download related software and modules

Cd / data/srcwget-c-P'/ data/src/' 'https://github.com/winshining/nginx-http-flv-module/archive/v1.2.7.tar.gz'-O' nginx-http-flv-module-1.2.7.tar.gz'wget-c-P'/ data/src' 'https://openresty.org/download/openresty-1.15.8.2.tar.gz'

Be careful not to use X Bao's "echo-nginx-module" module (one of the pits). After using this module, there was a compilation error, and I stepped on it here for a long time.

4. Start the installation

Cd / data/srctar-xzf nginx-http-flv-module-1.2.7.tar.gztar-xzf openresty-1.15.8.2.tar.gzcd openresty-1.15.8.2/./configure\-prefix=/data/local/openresty-1.15.8.2\-- sbin-path=/usr/sbin/openresty\-- user=www\-- group=www\-- with-luajit\-- with-http_ssl_module\-- with-http_iconv_module\-- with -http_v2_module\-- with-http_realip_module\-- with-http_sub_module\-- with-http_flv_module\-- with-http_mp4_module\-- with-http_gunzip_module\-- with-http_gzip_static_module\-- with-http_auth_request_module\-with-http_secure_link_module\-- with-http_stub_status_module\-- with-http_addition_module\-- add-module= / data/src/nginx-http-flv-module-1.2.7gmake-j `grep processor / proc/cpuinfo | wc-l` & & make install

Nginx-http-flv-module is a streaming media module and an upgraded version of the "nginx-rtmp-module" module. For details, see my other note, "[original] openresty build streaming".

Try using. / configure-- help to see more options.

The running error of the configuration file (. / configure script) can be found in build/nginx-VERSION/objs/autoconf.err. The place of the VERSION must correspond to the OpenResty version number, such as 0.8.54.6.

If there is no error in the whole process, the final appearance of "ln-sf / usr/sbin/openresty / data/local/openresty-1.15.8.2/bin/openresty" indicates that the compilation and installation is successful.

5. Check

[root@node1 ~] # openresty-vnginx version: openresty/1.15.8.2

6. Compilation parameters after successful installation

[root@node1] # openresty- Vnginx version: openresty/1.15.8.2built by gcc 8.3.0 (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017TLS SNI support enabledconfigure arguments:-- prefix=/data/local/openresty-1.15.8.2/nginx-- with-cc-opt=-O2-- add-module=../ngx_devel_kit-0.3.1rc1-- add-module=../iconv-nginx-module-0.14-- add-module=. / echo-nginx-module-0.61-- add-module=../xss-nginx-module-0.06-- add-module=../ngx_coolkit-0.2-- add-module=../set-misc-nginx-module-0.32-- add-module=../form-input-nginx-module-0.12-- add-module=../encrypted-session-nginx-module-0.08-- add-module=../srcache-nginx-module-0.31-- add -module=../ngx_lua-0.10.15-add-module=../ngx_lua_upstream-0.07-add-module=../headers-more-nginx-module-0.33-add-module=../array-var-nginx-module-0.05-add-module=../memc-nginx-module-0.19-add-module=../redis2-nginx-module-0.15-add-module=../redis-nginx-module-0.3 .7-add-module=../rds-json-nginx-module-0.15-add-module=../rds-csv-nginx-module-0.09-add-module=../ngx_stream_lua-0.0.7-with-ld-opt=-Wl -rpath / data/local/openresty-1.15.8.2/luajit/lib-sbin-path=/usr/sbin/openresty-user=www-group=www-with-http_ssl_module-with-http_v2_module-with-http_realip_module-with-http_sub_module-with-http_flv_module-with-http_mp4_module-with-http_gunzip_module with-http_gzip_static_module with-http_auth_request_module -- with-http_secure_link_module-- with-http_stub_status_module-- with-http_addition_module-- add-module=/data/src/nginx-http-flv-module-1.2.7-- with-stream-- with-stream_ssl_module-- with-stream_ssl_preread_ module [root @ node1] # Note:

1. Compilation parameters

If the compilation parameters take the following three parameters

-with-pcre=/data/src/pcre-8.43\-with-zlib=/data/src/zlib-1.2.11\-with-openssl=/data/src/openssl-1.1.1d\

The path after these three parameters does not refer to their installation path, but the path after downloading the corresponding package and then decompressing it. I've been walking in this pit for a long time (pit two).

Package download address reference:

Https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gzhttp://zlib.net/zlib-1.2.11.tar.gzhttps://www.openssl.org/source/openssl-1.1.1d.tar.gz

If you do not add these three parameters, the system library will be automatically called at compile time, provided that yum installs the devel package of three software (see above). If the following message appears during make, the call is successful, otherwise their library files will be installed.

Configuration summary + using system PCRE library + using system OpenSSL library + using system zlib library 3. Start shell > ss-tnl # View the started port shell > openresty # start shell > ss-tnl # check whether the openresty open port starts shell > openresty-s stop # stop shell > openresty-s reload # overload shell > openresty-t # Syntax check

Openresty command help, similar to nginx usage, you can add "- c" to call the configuration file

[root@node1 openresty-1.15.8.2] # openresty- hnginx version: openresty/1.15.8.2Usage: nginx [-? hvVtTq] [- s signal] [- c filename] [- p prefix] [- g directives] Options: -? -h: this help-v: show version and exit-V: show version and configure options then exit-t: test configuration and exit-T: test configuration, dump it and exit-Q: suppress non-error messages during configuration testing-s signal: send signal to a master process: stop, quit, reopen Reload-p prefix: set prefix path (default: / data/local/openresty-1.15.8.2/nginx/)-c filename: set configuration file (default: conf/nginx.conf)-g directives: set global directives out of configuration file [root@node1 openresty-1.15.8.2] # openresty

IV. Testing

Browser input: http:// you test the machine IP/

If the browser does not display, release the firewall port:

Sudo ss-tnlsudo cp / usr/lib/firewalld/services/http.xml / etc/firewalld/services/sudo firewall-cmd-permanent-- zone=public-- add-service=httpsudo firewall-cmd-- reload

Or turn off the firewall:

Systemctl stop firewalld.servicess-tnl

If you think this article is helpful to you, please give me some comments or comments, thank you!

English version: https://github.com/openresty/openresty/issues/551

Original article, reproduced, please indicate the source: https://blog.51cto.com/indian/2445786

Tags: Compilation parameters modules paths success ports systems sources original articles commands tools files articles streaming media browsers environments software problems firewalls Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Tech Info Redmi macOS Docker