全网最详细的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) 

 

 

 

 

 

 

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/zlslch/p/10318884.html

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值