您的位置:首页 > 运维架构

Openresty 安装与 Hello World

2019-03-23 15:14 88 查看
版权声明:@潘广宇博客, https://blog.csdn.net/panguangyuu/article/details/88761509

一、Openresty 介绍

OpenResty 是一个基于 Nginx 与 Lua 的高性能 Web 平台,集成许多优良的 Lua 库、第三方模块等。

可以快速构建出足以胜任 10K 甚至 1000K 单机并发连接的高性能 Web 应用系统

二、安装 Openresty

找到最新的安装包 https://openresty.org/cn/download.html ,如:openresty-1.13.6.2.tar.gz

[code]tar -xzvf openresty-VERSION.tar.gz

cd openresty-VERSION/

./configure --with-luajit \
--with-http_iconv_module \

make && make install

三、Hello World DEMO

新建一个文件夹 work,下面创建 logs/ conf/ 子文件夹

[code]vim conf/nginx.conf
[code]worker_processes  1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}

保存后

[code]cd /usr/local/openresty/nginx/sbin

./nginx -c /root/work/conf/nginx.conf

四、查看 Hello World 确认 Openresty 安装成功

[code]curl http://localhost:8080/

# 可见 <p>hello</p> 代表 openresty 安装成功

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: