Ubuntu安装OpenResty

1、安装依赖包

sudo apt install libpcre3-dev libssl-dev perl make build-essential curl zlib1g-dev

2、编译安装

sudo tar zxvf openresty-1.21.4.1.tar.gz
cd openresty-1.21.4.1 
sudo ./configure --prefix=/usr/local/openresty --with-http_stub_status_module --with-http_gzip_static_module --with-luajit
sudo make -j4
sudo make install

3、设置启动脚本

sudo vi /usr/lib/systemd/system/nginx.service
[Unit]
Description=OpenResty
After=network.target [Service] Type
=forking PIDFile=/usr/local/openresty/nginx/logs/nginx.pid ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t -q -g 'daemon on; master_process on;' ExecStart=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' ExecReload=/usr/local/openresty/nginx/sbin/nginx -g 'daemon on; master_process on;' -s reload ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /usr/local/openresty/nginx/logs/nginx.pid TimeoutStopSec=5 KillMode=mixed [Install] WantedBy=multi-user.target

# 重新加载服务的配置文件

sudo systemctl daemon-reload

# 设置自启动

sudo systemctl enable nginx

# 启动

sudo systemctl start nginx

# 查看服务状态

sudo systemctl status nginx

# 停止

sudo systemctl stop nginx

 

posted @ 2022-06-23 09:00  缤纷世界  阅读(161)  评论(0编辑  收藏  举报