全網最詳細的Centos7系統里安裝Openresty(圖文詳解)


 

 

    不多說,直接上干貨!

 

 

介紹:

   Nginx 采用一個 master 進程管理多個 worker 進程(master-worker)模式,基本的事件處理都在 woker 中,master 負責一些全局初始化,以及對 worker 的管理。在OpenResty中,每個 woker 使用一個 LuaVM,當請求被分配到 woker 時,將在這個 LuaVM 里創建一個 coroutine(協程)。協程之間數據隔離,每個協程具有獨立的全局變量_G。OpenResty致力於將服務器應用完全運行與nginx中,充分利用nginx事件模型進行非阻塞I/O通信。其對MySQL、redis、Memcached的I\O通信操作也是非阻塞的,可以輕松應對10K以上的超高連接並發。

 

 

 

 

 

 

 安裝

   1)、通過在CentOS 系統中添加 openresty 倉庫,便於未來安裝或更新我們的軟件包(通過 yum update 命令)

 

[root@ninbdcpp ~]# sudo yum install yum-utils

 

 

 

 

 

 

[root@ninbdcpp ~]# sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

 

 

 

 

 

 

 

 

  2)、安裝openresty

 

[root@ninbdcpp ~]# sudo yum install openresty
Is this ok [y/N]: y
Is this ok [y/d/N]: y
Is this ok [y/d/N]: y

 

 

 

 

 

  3)、安裝命令行工具 resty

[root@ninbdcpp ~]# sudo yum install openresty-resty
Is this ok [y/d/N]: y

 

  命令行工具 opm 在 openresty-opm 包里,而 restydoc 工具在 openresty-doc 包里頭。

 

 

 

   4)、查看openresty 倉庫里頭的軟件包

[root@ninbdcpp ~]# sudo yum --disablerepo="*" --enablerepo="openresty" list available
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Packages
openresty-asan.x86_64                                                                                        1.13.6.2-5.el7.centos                                                                      openresty
openresty-asan-debuginfo.x86_64                                                                              1.13.6.2-5.el7.centos                                                                      openresty
openresty-debug.x86_64                                                                                       1.13.6.2-1.el7.centos                                                                      openresty
openresty-debug-debuginfo.x86_64                                                                             1.13.6.2-1.el7.centos                                                                      openresty
openresty-debuginfo.x86_64                                                                                   1.13.6.2-1.el7.centos                                                                      openresty
openresty-doc.noarch                                                                                         1.13.6.2-1.el7.centos                                                                      openresty
openresty-openssl-asan.x86_64                                                                                1.1.0h-8.el7.centos                                                                        openresty
openresty-openssl-asan-debuginfo.x86_64                                                                      1.1.0h-8.el7.centos                                                                        openresty
openresty-openssl-asan-devel.x86_64                                                                          1.1.0h-8.el7.centos                                                                        openresty
openresty-openssl-debug.x86_64                                                                               1.1.0h-3.el7.centos                                                                        openresty
openresty-openssl-debug-debuginfo.x86_64                                                                     1.1.0h-3.el7.centos                                                                        openresty
openresty-openssl-debug-devel.x86_64                                                                         1.1.0h-3.el7.centos                                                                        openresty
openresty-openssl-debuginfo.x86_64                                                                           1.1.0h-3.el7.centos                                                                        openresty
openresty-openssl-devel.x86_64                                                                               1.1.0h-3.el7.centos                                                                        openresty
openresty-opm.noarch                                                                                         1.13.6.2-1.el7.centos                                                                      openresty
openresty-pcre-asan.x86_64                                                                                   8.42-12.el7.centos                                                                         openresty
openresty-pcre-asan-debuginfo.x86_64                                                                         8.42-12.el7.centos                                                                         openresty
openresty-pcre-asan-devel.x86_64                                                                             8.42-12.el7.centos                                                                         openresty
openresty-pcre-debuginfo.x86_64                                                                              8.42-1.el7.centos                                                                          openresty
openresty-pcre-devel.x86_64                                                                                  8.42-1.el7.centos                                                                          openresty
openresty-valgrind.x86_64                                                                                    1.13.6.2-1.el7.centos                                                                      openresty
openresty-valgrind-debuginfo.x86_64                                                                          1.13.6.2-1.el7.centos                                                                      openresty
openresty-zlib-asan.x86_64                                                                                   1.2.11-11.el7.centos                                                                       openresty
openresty-zlib-asan-debuginfo.x86_64                                                                         1.2.11-11.el7.centos                                                                       openresty
openresty-zlib-asan-devel.x86_64                                                                             1.2.11-11.el7.centos                                                                       openresty
openresty-zlib-debuginfo.x86_64                                                                              1.2.11-3.el7.centos                                                                        openresty
openresty-zlib-devel.x86_64                                                                                  1.2.11-3.el7.centos                                                                        openresty
perl-Lemplate.noarch                                                                                         0.15-1.el7.centos                                                                          openresty
perl-Spiffy.noarch                                                                                           0.46-3.el7.centos                                                                          openresty
perl-Test-Base.noarch                                                                                        0.88-2.el7.centos                                                                          openresty
perl-Test-LongString.noarch                                                                                  0.17-1.el7.centos                                                                          openresty
perl-Test-Nginx.noarch                                                                                       0.26-1.el7.centos                                                                          openresty
[root@ninbdcpp ~]# 

 

 

 

  至此安裝成功,默認安裝在  /usr/local/openresty

 

 

[root@ninbdcpp ~]# cd /usr/local/openresty/
[root@ninbdcpp openresty]# pwd
/usr/local/openresty
[root@ninbdcpp openresty]# ll
total 24
drwxr-xr-x. 2 root root    36 Jan 25 21:41 bin
-rw-r--r--. 1 root root 22924 May 15  2018 COPYRIGHT
drwxr-xr-x. 6 root root    56 Jan 25 21:40 luajit
drwxr-xr-x. 5 root root    59 Jan 25 21:40 lualib
drwxr-xr-x. 7 root root    68 Jan 25 21:40 nginx
drwxr-xr-x. 4 root root    28 Jan 25 21:40 openssl
drwxr-xr-x. 3 root root    17 Jan 25 21:40 pcre
drwxr-xr-x. 3 root root    20 Jan 25 21:40 site
drwxr-xr-x. 3 root root    17 Jan 25 21:40 zlib
[root@ninbdcpp openresty]# 

 

 

 

 

 

 

 

 

測試

  啟動

[root@ninbdcpp openresty]# sudo /sbin/service openresty start
Starting openresty (via systemctl):                        [  OK  ]
[root@ninbdcpp openresty]# 

 

 

 

 

 

 

[root@ninbdcpp openresty]# sudo /sbin/service openresty stop
Stopping openresty (via systemctl):                        [  OK  ]
[root@ninbdcpp openresty]# 

 

 

 

 

 

 

 

 

 

 

 

歡迎大家,加入我的微信公眾號:大數據躺過的坑        人工智能躺過的坑
 
 
 

同時,大家可以關注我的個人博客

   http://www.cnblogs.com/zlslch/   和     http://www.cnblogs.com/lchzls/      http://www.cnblogs.com/sunnyDream/   

   詳情請見:http://www.cnblogs.com/zlslch/p/7473861.html

 

  人生苦短,我願分享。本公眾號將秉持活到老學到老學習無休止的交流分享開源精神,匯聚於互聯網和個人學習工作的精華干貨知識,一切來於互聯網,反饋回互聯網。
  目前研究領域:大數據、機器學習、深度學習、人工智能、數據挖掘、數據分析。 語言涉及:Java、Scala、Python、Shell、Linux等 。同時還涉及平常所使用的手機、電腦和互聯網上的使用技巧、問題和實用軟件。 只要你一直關注和呆在群里,每天必須有收獲

 

      對應本平台的討論和答疑QQ群:大數據和人工智能躺過的坑(總群)(161156071) 

 

 

 

 

 

 

 

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM