openresty安装

 

openresty安装

前置条件安装

ubuntu
apt-get install libpcre3-dev \
libssl-dev perl make build-essential curl

centos
yum install pcre-devel openssl-devel gcc curl

 

下载openresty
wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
tar -xvf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2/

安装
./configure
make
make install

检查是否安装成功
whereis openresty


启动
cd /usr/local/openresty
./bin/openresty

访问
curl http://localhost


设置环境变量
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH


其它命令
nginx -p `pwd`/ -c conf/nginx.conf

-p指定prefix目录 ,默认为/usr/local/openresty/nginx/
-c指定配置文件

 

ubuntu 设置openresty 开机启动

vim /etc/rc.local
增加
/usr/local/openresty/bin/openresty


重要说明
可能重启后不起作用,这时需要个性rc.local权限
sudo chmod +x /etc/rc.local // 增加可执行权限
sudo chmod +s /etc/rc.local // 让普通用户执行该文件时拥有文件所有者的权限

如果还不起作用,需要修改默认bash
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh

 

posted @ 2019-07-08 17:43  liuxm-刘小明  阅读(360)  评论(0编辑  收藏  举报