有一個項目是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