一、OpenResty安装
官网下载相应版本源码包:http://openresty.org/en/download.html
1 #准备编译环境 2 yum install pcre-devel openssl-devel gcc curl(centos) 3 apt-get install libpcre3-dev libssl-dev perl make build-essential curl (Ubuntu) 4 5 #编译安装 6 wget https://openresty.org/download/openresty-1.15.8.3.tar.gz 7 tar -xvf openresty-VERSION.tar.gz 8 cd openresty-VERSION/ 9 ./configure 10 make 11 sudo make install 12 13 #添加环境变量 14 vim ~/.bashrc 15 export PATH=/usr/local/openresty/bin:$PATH 16 source ~/.bashrc
测试
resty -e ‘print("hello, world")‘
启动/停止/重启服务命令(热加载)
#同样添加nginx环境变量 export PATH=/usr/local/openresty/nginx/sbin:$PATH #启动服务 nginx #停止服务 nginx -s stop #热加载 nginx -s reload