为已安装的Nginx添加module操作方法

Kevin 教程 1,478 次浏览 49条评论

为了安装和后续更新方便,平时习惯使用Nginx预构建版本,也就是通过包管理器安装。默认包括绝大多Nginx模块,省去了各项手动配置的麻烦。如果安装后要添加其它功能,需要下载Nginx源码重新编译。在配置里加入新的模块,并替换新执行文件。下面以添加nginx-rtmp-module为例介绍具体方法。

准备工作

1. 安装必要的软件工具,有下载、解压、编译器、Nginx依赖项等。

yum install -y wget unzip gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel

2. 运行nginx -V命令查看Nginx配置,复制configure arguments: 后面内容保存,之后要用到。

3. 下载同样版本Nginx和要添加模块的源码包,解压备用,操作路径可随意。

# Nginx源码包,这里我下载到/tmp目录操作
cd /tmp
wget https://nginx.org/download/nginx-1.14.1.tar.gz
tar zxf nginx-1.14.1.tar.gz

# 要添加的RTMP模块源码包,解压至默认模块目录
cd /usr/lib64/nginx/modules
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip

编译添加

1. systemctl stop nginx关闭正在运行的Nginx服务。

2. 进入之前解压的Nginx目录,运行下面命令编译一遍。红色部分为添加模块。

cd /tmp/nginx-1.14.1
./configure [此处粘贴之前查询的Nginx编译参数] --add-module=/usr/lib64/nginx/modules/nginx-rtmp-module-master
make

3. 编译后会在当前objs目录下生成nginx执行文件,在备份原文件后用其替换。

mv /usr/sbin/nginx /usr/sbin/nginx.bak
cp -fp /tmp/nginx-1.14.1/objs/nginx /usr/sbin

4. 到此编译添加完成,systemctl start nginx恢复服务。

要确认是否添加成功,可用nginx -V 2>&1 | sed 's/ /\n/g'命令格式化查看编译参数。

注意事项

实际操作时需留意路径是否正确,不同系统和Nginx安装方式,默认路径可能不一样。另外编译步骤最后不要运行make install,不然会覆盖之前已安装的Nginx,配置文件也没了。

评论列表

  1. #1

    hydroxychloroquine and azithromycin evidence https://hydroxychloroquine.webbfenix.com/

  2. #2

    ivermectin dosing norwegian scabies https://ivermectin.mlsmalta.com/

  3. #3

    what color is bimatoprost https://carepro1st.com/

  4. #4

    how much vidalista is safe https://vidalista.mlsmalta.com/

  5. #5

    ivermectin shelf life https://ivermectin.webbfenix.com/

  6. #6

    buy hydroxychloroquine online india https://hydroxychloroquine.mlsmalta.com/

  7. #7

    cialis fast delivery uk http://www.lm360.us/

  8. #8

    generic sildenafil citrate india http://droga5.net/

  9. #9

    tamoxifen for dcis https://tamoxifen.mrdgeography.com/

  10. #10

    how to take ivermectin orally https://ivermectin1st.com/

  11. #11

    contraindications for aurogra https://aurogra.buszcentrum.com/

  12. #12

    can you take suhagra every day https://suhagra.buszcentrum.com/

  13. #13

    prolonged use of vidalista https://vidalista40mg.mlsmalta.com/

  14. #14

    cialis scam https://wisig.org/

  15. #15

    side effects of priligy on men https://ddapoxetine.com/

  16. #16

    cheapest inhaler for copd https://amstyles.com/

  17. #17

    buy chloroquine phosphate australia https://hydroxychloroquinee.com/

  18. #18

    why is doxycycline so expensive http://doxycycline.zolftgenwell.org/

  19. #19

    tadalafil prescribing information https://tadalafil.cleckleyfloors.com/

  20. #20

    international online pharmacies india https://edmeds.buszcentrum.com/

  21. #21

    does walmart carry generic dapoxetine https://dapoxetine.confrancisyalgomas.com/

  22. #22

    plaquenil dosing calc https://hydroxychloroquine.wisig.org/

  23. #23

    plaquenil dosing calc https://hydroxychloroquine.mymvrc.org/

  24. #24

    where can i get vidalista over the counter http://viidalista.co/

  25. #25

    suprax indication & uses https://ceefexime.co/

  26. #26

    how does sildenafil citrate work https://viaplz.com/

  27. #27

    cialis coupon cvs http://cialis.audiovideoninja.com/

  28. #28

    cialis coupon cvs https://cialis.lm360.us/

  29. #29

    hydroxychloroquine plaquenil side effects http://hydroxychloroquined.online/

  30. #30

    didier raoult hydroxychloroquine https://hhydroxychloroquine.com/

  31. #31

    buy viagra cialis levitra online https://cialis.confrancisyalgomas.com/

  32. #32

    buy viagra cialis levitra online https://cialis.cleckleyfloors.com/

  33. #33

    Wonderful beat ! I would like to apprentice while you amend your web site, how
    can i subscribe for a blog web site? The account aided me a acceptable deal.
    I had been a little bit acquainted of this your broadcast
    offered bright clear concept https://cialis.buszcentrum.com/tadalafil

  34. #34

    vidalista 60

  35. #35

    viagra coupons

  36. #36

    viagra without a doctors prescription

  37. #37

    farmacia juan manuel duran http://essinreceta.com/ generico cialis

  38. #38

    Thank you for gclub will bring this article to my wife. Because she is losing weight And this article, exercises that I can go out with with her Makes us more fun and healthy The important thing is that I lost weight.

  39. #39

    This musician Have a lot of three cars sexygame Because this person is the most professional And to stand at the top of this work Go through many obstacles I love you very much.

  40. #40

    I really like the lsm99 speed. And Rossi’s fierce competition and a huge fan of Antonio Rossi.

  41. #41

    Fabio Clemente at gclub having a Brazilian player. Because of the football kick The Brazilian national team is already very talented in their blood. And can adapt the best

  42. #42

    bookmarked!!, I really like your ufabet phone hack calls Anytime, anywhere Convenient

  43. #43

    And as a model to measure the choice of online football gambling as a model เว็บพนันออนไลน์ during the disclosure of enhancing extra income fully. And support the opportunity to measure confidence is more important than ever Ready to continuously win money prizes

  44. #44

    Learn to enjoy every minute of your life. Be happy now Don’t wait for something outside of you to เว็บพนัน bring you happiness in the future.

  45. #45

    I take a look at you and love slotxo the car you’re making a lot.

  46. #46

    Thank you for introducing first. likes its simplicity 918kiss same. But the theme you recommend Really easy to use, thank you very much.

  47. #47

    how to get vidalista cheap http://vidallista.com/

  48. #48

    Your building ufa168, thought it was very good and The patterns in which you deal with problems around you I certify that the best.

  49. #49

    This restaurant is very delicious. ufabet168 to bring out the flavor of the ingredients very well. There is a lot of umami. As for the service, I give it a full five stars.

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。