1. 安装nginx

2. 查看版本&下载源码

nginx -v

  1. wget https://nginx.org/download/nginx-1.12.2.tar.gz
  2. git clone https://github.com/arut/nginx-rtmp-module.git
  3. cd nginx-rtmp-module
  4. git checkout $(git describe --abbrev=0 --tags)

3. 安装依赖

  1. yum -y install {GeoIP,gd,gperftools,libxml2,libxslt,openssl,pcre,perl,zlib}-devel perl-ExtUtils-Embed redhat-rpm-config

4. 编译安装

停服务

  1. systemctl stop nginx

配置参数

  1. ./configure --prefix=/usr/share/nginx \
  2. --sbin-path=/usr/sbin/nginx \
  3. --modules-path=/usr/lib64/nginx/modules \
  4. --conf-path=/etc/nginx/nginx.conf \
  5. --error-log-path=/var/log/nginx/error.log \
  6. --http-log-path=/var/log/nginx/access.log \
  7. --http-client-body-temp-path=/var/lib/nginx/tmp/client_body \
  8. --http-proxy-temp-path=/var/lib/nginx/tmp/proxy \
  9. --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi \
  10. --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi \
  11. --http-scgi-temp-path=/var/lib/nginx/tmp/scgi \
  12. --pid-path=/run/nginx.pid \
  13. --lock-path=/run/lock/subsys/nginx \
  14. --user=nginx \
  15. --group=nginx \
  16. --with-file-aio \
  17. --with-ipv6 \
  18. --with-http_ssl_module \
  19. --with-http_v2_module \
  20. --with-http_realip_module \
  21. --with-http_addition_module \
  22. --with-http_xslt_module=dynamic \
  23. --with-http_image_filter_module=dynamic \
  24. --with-http_geoip_module=dynamic \
  25. --with-http_sub_module \
  26. --with-http_dav_module \
  27. --with-http_flv_module \
  28. --with-http_mp4_module \
  29. --with-http_gunzip_module \
  30. --with-http_gzip_static_module \
  31. --with-http_random_index_module \
  32. --with-http_secure_link_module \
  33. --with-http_degradation_module \
  34. --with-http_slice_module \
  35. --with-http_stub_status_module \
  36. --with-http_perl_module=dynamic \
  37. --with-mail=dynamic \
  38. --with-mail_ssl_module \
  39. --with-pcre \
  40. --with-pcre-jit \
  41. --with-stream=dynamic \
  42. --with-stream_ssl_module \
  43. --with-google_perftools_module \
  44. --with-debug \
  45. --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' \
  46. --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' \
  47. --add-module=../nginx-rtmp-module

编译安装

  1. make
  2. make install

5. 禁止 yum 更新 nginx

编辑配置文件

  1. vim /etc/yum.conf

添加

  1. exclude=nginx*