Linux centos7.3下安装openresty(nginx)+php7.3运行环境 超级详细

OpenResty介绍:

   Nginx 是采用一个 master 进程管理多个 worker 进程(master-worker)的模式,基本的事件处理都在 woker 当中,master 负责一些全局初始化,以及对 worker 的管理的事情。在OpenResty中,每个 woker 使用一个 LuaVM(这里不详细说明lua有兴趣的可以百度),当请求被分配到 woker 中时,将在这个 LuaVM 里创建一个 coroutine(协程)。协程之间有数据隔离,每个协程具有独立的全局变量_G。OpenResty致力于将服务器应用完全运行与nginx当中,充分利用nginx事件模型进行非阻塞的I/O通信。其对MySQL、redis、Memcached的I\O通信操作也是非阻塞的,可以轻松应对10K以上的超高连接并发。(综上所述大概就是比nginx好很多)

OpenResty官网链接      Lua语言官网      Lua教程

安装OpenResty:

1. 通过在CentOS 系统中添加 openresty 仓库,便于未来安装或更新我们的软件包(通过 yum update 命令)



[root@izuf6bgrqpp01oqg9andmhz /]# yum install yum-utils

2.



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

3.开始安装OpenResty

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

4.安装Resty命令行工具

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

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

5.安装完成查看软件包

[root@izuf6bgrqpp01oqg9andmhz /]# yum --disablerepo="*" --enablerepo="openresty" list available

6.默认安装在 /usr/local/openresty

7.启动以及常用命令

启动
[root@izuf6bgrqpp01oqg9andmhz openresty]# /sbin/service openresty start

查看状态
[root@izuf6bgrqpp01oqg9andmhz /]# systemctl status openresty.service

启动失败查看端口占用
[root@izuf6bgrqpp01oqg9andmhz /]# netstat -lnp|grep 80

杀死进程
[root@izuf6bgrqpp01oqg9andmhz /]# kill -9 8899

nginx重载配置文件
[root@izuf6bgrqpp01oqg9andmhz sbin]# ./nginx -s reload

安装PHP7.3:

1.首先需要安装 EPEL 源: 

[root@izuf6bgrqpp01oqg9andmhz /]# yum install epel-release

2.再安装 REMI 源:

[root@izuf6bgrqpp01oqg9andmhz /]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

3.然后安装 Yum 源管理工具:(安装过可忽略)

[root@izuf6bgrqpp01oqg9andmhz /]# yum install yum-utils

4.安装php73:

[root@izuf6bgrqpp01oqg9andmhz /]# yum --enablerepo=remi-php73 install php

5.安装常用PHP扩展:(卸载:yum --enablerepo=remi-php73 remove xxx xxx ..

[root@izuf6bgrqpp01oqg9andmhz /]# yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-devel php-mysql php-gd php-bcmath php-pdo php-pecl-imagick php-fpm -y

6.开启php-fpm:

[root@izuf6bgrqpp01oqg9andmhz /]# systemctl start php-fpm

7.查看PHP版本信息(附上结果):

[root@izuf6bgrqpp01oqg9andmhz /]# php -v
PHP 7.3.32 (cli) (built: Oct 26 2021 15:07:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.32, Copyright (c) 1998-2018 Zend Technologies

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值