參考網址:
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