参考网址:
http://openresty.org/cn/installation.htmlhtml
1.安装前的准备 Mac OS X (Darwin) 用户nginx
使用brew工具安装pcre、openssl库: brew install pcre openssl工具
2.下载 OpenResty的源码包l, 请到 Download 页下载lua
下载成功后解压openresty-1.9.15.1(版本号)spa
3. 使用终端,cd 到openresty-1.9.15.1目录下编译、安装openresty3d
(1)$ ./configure \
rest
--with-cc-opt="-I/usr/local/opt/openssl/include/ -I/usr/local/opt/pcre/include/" \
code
/usr/local/ 目录:--with-ld-opt="-L/usr/local/opt/openssl/lib/ -L/usr/local/opt/pcre/lib/" \ -j8
(2)make
(3)make install
4.安装完成后,openresty会安装到
5.启动openresty
/usr/local/openresty/nginx/sbin/nginx
6.指定配置文件启动openresty 指定一个工程目录
cd /Users/xinshaofeng/Study/
mkdir nginx
cd nginx
mkdir conf logs lua
cd conf
vi nginx.conf 把原来/usr/local/openresty/nginx/conf/nginx.conf内容拷贝进来 cd 到nginx目录下 cd /Users/xinshaofeng/Study/nginx -c 指定配置文件 -p . 指定工程目录 . 当前目录 -s reload 修改配置文件后重启 -s stop 中止 pkill nginx 杀死nginx进程 ps -ef | grep nginx 查看nginx进程 sudo /usr/local/openresty/nginx/sbin/nginx -c conf/nginx.conf -p .sudo