龙空技术网

Centos6系统安装OpenResty

testerzhang 173

前言:

今天你们对“centos6安装wget”大体比较关心,姐妹们都想要知道一些“centos6安装wget”的相关文章。那么小编也在网络上网罗了一些对于“centos6安装wget””的相关文章,希望我们能喜欢,同学们一起来学习一下吧!

今年6月份的时候安装了OpenResty,这里简单记录了下过程。

开始

1.OpenResty是什么

OpenResty是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。

用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。

让我们开始安装吧

2.安装

下面以openresty/1.15.8.3为例,进行说明如何安装。

2.1 安装系统依赖库

# yum install readline-devel pcre-devel openssl-devel
2.2 安装yum源
# wget  mv openresty.repo /etc/yum.repos.d/# yum check-update
2.3 安装openresty
# yum install -y openresty
2.4 验证
#  openresty -hnginx version: openresty/1.15.8.3Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]Options:  -?,-h         : this help  -v            : show version and exit  -V            : show version and configure options then exit  -t            : test configuration and exit  -T            : test configuration, dump it and exit  -q            : suppress non-error messages during configuration testing  -s signal     : send signal to a master process: stop, quit, reopen, reload  -p prefix     : set prefix path (default: /usr/local/openresty/nginx/)  -c filename   : set configuration file (default: conf/nginx.conf)  -g directives : set global directives out of configuration file

安装完成,下面我们继续部署吧

3.部署3.1 准备目录

# mkdir ~/work# cd ~/work# mkdir logs/ conf/
3.2 编写nginx配置文件
worker_processes  1;error_log logs/error.log;events {    worker_connections 1024;}http {    server {        listen 8080;        location / {            default_type text/html;            content_by_lua_block {                ngx.say("<p>hello, world</p>")            }        }    }}

注意:

如果端口被其他进程占用,改下端口即可。建议配置文件增加一个配置user root;3.2 追加环境变量

# vim ~/.bash_profile PATH=/usr/local/openresty/nginx/sbin:$PATHexport PATH
3.3 生效环境变量
# source  ~/.bash_profile 
3.4 启动服务
# cd ~/work# nginx -p `pwd`/ -c conf/nginx.conf
3.5 验证

访问网址,出现hello, world就部署成功了。

结束

结束语

当我们部署完OpenResty服务后,我们可以写lua脚本来实现我们的定制化服务。

喜欢本文的可以@testerzhang关注,也欢迎大家关注我的同名gong zhong hao。

标签: #centos6安装wget