yum install -y pcre-devel openssl-devel gcc curl; wget https://openresty.org/download/openresty-1.21.4.3.tar.gz; tar -zxvf openresty-1.21.4.3.tar.gz; cd openresty-1.21.4.3; ./configure --prefix=/home/web/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module; make & make install;
若要允许以非root用户启用80端口,以root运行下面命令:
setcap 'cap_net_bind_service=+ep' /home/web/openresty/nginx/sbin/nginx
设置开机启动:
vi /etc/systemd/system/openresty.service
内容如下:
[Unit] Description=OpenResty nginx server After=network.target [Service] Type=forking ExecStart=/home/web/openresty/bin/openresty -g "daemon on; master_process on;" ExecReload=/home/web/openresty/bin/openresty -t -c /home/web/openresty/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID KillMode=process KillSignal=SIGQUIT TimeoutStopSec=5 PrivateTmp=true Restart=on-failure LimitNOFILE=4096 [Install] WantedBy=multi-user.target
参考:
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END