有一个项目是Lua库写的,须要部署一个web服务器,考虑Openresty对lua的支持,部署Openresty。html
<p>官方说明:OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建可以处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。</p>nginx
$ yum install -y pcre-devel openssl-devel gcc curl
$ wget https://openresty.org/download/openresty-1.15.8.1.tar.gz
$ tar -xzvf openresty-1.15.8.1.tar.gz
$ cd openresty-1.15.8.1/
$ ./configure
6.编译安装:web
$ gmake && gmake install
安装结果:shell
mkdir -p /usr/local/openresty/site/lualib /usr/local/openresty/site/pod /usr/local/openresty/site/manifest ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/openresty/bin/openresty
能够看到openresty 其实是nginx的软链接。服务器
$ /usr/local/openresty/bin/openresty -v nginx version: openresty/1.15.8.3
检验配置 /usr/local/openresty/bin/openresty -t 启动 /usr/local/openresty/bin/openresty 中止 /usr/local/openresty/bin/openresty -s stop 从新加载配置 /usr/local/openresty/bin/openresty -s reload
[Unit] Description=openresty - high performance web server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/openresty/bin/openresty -c /usr/local/openresty/nginx/conf/nginx.conf ExecReload=/usr/local/openresty/bin/openresty -s reload ExecStop=/usr/local/openresty/bin/openresty -s stop [Install] WantedBy=multi-user.target
添加openresty.service后,使配置文件生效:并发
$ systemctl daemon-reload
而后,就能够使用systemctl管理openresty:curl
启动 $ systemctl start openresty 中止 $ systemctl stop openresty 重载配置 $ systemctl reload openresty 重启 $ systemctl restart openresty