Je fais une récap complète comme ça si d'autres veulent compléter .. et au cas ou les admin y verraient un avantage à le glisser comme tuto.
Globalement c'est le même schéma que précédemment
apt remove --purge nginx
Nécessaire pour compiler
apt-get install libgeoip-dev libxslt-dev libpcre3 libpcre3-dev build-essential zlib1g-dev libbz2-dev libssl-dev tar unzip curl git -y
Téléchargement de la dernière version de Nginx
cd /usr/src
wget https://nginx.org/download/nginx-1.15.0.tar.gz
tar -xaf nginx-1.15.0.tar.gz
mv nginx-1.15.0 nginx
Création du user "nginx"
sudo useradd -s /sbin/nologin nginx
Téléchargement des sources rtmp à partir du github
git clone https://github.com/arut/nginx-rtmp-module.git
Puis
cd /usr/src/nginx
Lancement des options de compilation
sudo ./configure --user=nginx --group=nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_xslt_module=dynamic --with-http_image_filter_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_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_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module --with-http_perl_module=dynamic --with-mail --with-mail=dynamic --with-mail_ssl_module --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module --with-stream_geoip_module=dynamic --with-stream_ssl_preread_module --with-google_perftools_module --with-cpp_test_module --with-compat --with-pcre --with-pcre-jit --with-zlib-asm=CPU --with-debug --with-ld-opt="-Wl,-E" --add-module=/usr/src/nginx-rtmp-module --with-debug
Plusieurs erreurs possibles listées ci dessous :
Package to install: gcc
./configure: error: C compiler cc is not found
Package to install: lipcre3-dev
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
Package to install: zlib1g-dev
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
Package to install: libxml2-dev, libxslt1-dev
./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries
Package to install: libgd-dev
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
Package to install: libgeoip1 libgeoip-dev
./configure: error: the GeoIP module requires the GeoIP library.
You can either do not enable the module or install the library.
Package to install: google-perftools, libgoogle-perftools-dev
./configure: error: the Google perftools module requires the Google perftools
library. You can either do not enable the module or install the library.
Package to install: libatomic-ops-dev
./configure: error: libatomic_ops library was not found.
Package to install: libperl-dev
/usr/bin/x86_64-linux-gnu-ld: cannot find -lperl
collect2: error: ld returned 1 exit status
objs/Makefile:1607: recipe for target 'objs/ngx_http_perl_module.so' failed
make[1]: *** [objs/ngx_http_perl_module.so] Error 1
make[1]: Leaving directory '/root/nginx-1.14.0'
Makefile:8: recipe for target 'build' failed
En ce qui me concerne j'ai eu les erreurs suivantes
error: the HTTP image filter module requires the GD library
error: the Google perftools module requires the Google perftools
J'ai donc installé les paquets suivants :
apt install libgd-dev
apt install google-perftools
apt install libgoogle-perftools-dev
Ensuite
make -j $(nproc)
make install
Création du service systemd pour nginx
nano /etc/systemd/system/nginx.service
Copier/coller
[Unit]
Description=The Nginx 1.15 service
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Enfin
systemctl enable nginx.service
systemctl start nginx.service
Vérification :
root@vps554379:~# systemctl status nginx.service
● nginx.service - The Nginx 1.15 service
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-13 13:24:13 CEST; 6min ago
Process: 25376 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
Process: 25385 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 25380 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 25387 (nginx)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/nginx.service
├─25387 nginx: master process /usr/sbin/nginx
└─25388 nginx: worker process
Jun 13 13:24:13 vps554379 systemd[1]: Starting The Nginx 1.15 service...
Jun 13 13:24:13 vps554379 nginx[25380]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jun 13 13:24:13 vps554379 nginx[25380]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jun 13 13:24:13 vps554379 systemd[1]: Started The Nginx 1.15 service.
root@vps554379:~# nginx -V
nginx version: nginx/1.15.0
built by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
built with OpenSSL 1.1.0f 25 May 2017
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_stub_status_module --with-ld-opt=-lrt --prefix=/etc/nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --sbin-path=/usr/local/sbin/nginx --user=nginx --group=nginx --add-module=/usr/src/nginx-rtmp-module --with-debug
Encore une fois les options de configurations sont adaptables selon les besoins et le principe de compilation restera toujours le même.
http://sharadchhetri.com/2018/05/15/install-and-compile-nginx-1-14-on-ubuntu-18-04-lts-server/
https://www.noobunbox.net/serveur/auto-hebergement/nginx-tls-1-3
https://github.com/arut/nginx-rtmp-module
https://mondedie.fr/d/7621-Tuto-Compiler-la-derniere-version-de-nginx-avec-LibreSSL