macox 安装openresty,macox安装openresty


1、下载 https://openresty.org/download/ngx_openresty-1.9.7.1.tar.gz

2、安装包管理器  

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3、安装必要的包

$ brew update  

$ brew install pcre openssl

4、解压

$ tar xzvf ngx_openresty-1.9.7.1

5、进入解压目录

$ cd ngx_openresty-1.9.7.1 

6、配置制定pcre与openssl目录,如不指定会报错找不到,并用超级账户执行

$ sudo ./configure --prefix=/Users/bahaidong/soft/openresty\
              --with-cc-opt="-I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/pcre/include" \

              --with-ld-opt="-L/usr/local/opt/openssl/lib/ -L/usr/local/opt/pcre/lib/"

7、$ sudo make

8、$ sudo make install

9、启动

$ sudo ~/soft/openresty/nginx/sbin/nginx -p ~/soft/openresty/nginx/ -c ~/soft/openresty/nginx/conf/nginx.conf

10、查看

¥$ ps -ef | grep nginx

出现如下说名启动成功

 0 43905     1   0  1:57下午 ??         0:00.00 nginx: master process /Users/bahaidong/soft/openresty/nginx/sbin/nginx -p /Users/bahaidong/soft/openresty/nginx/ -c /Users/bahaidong/soft/openresty/nginx/conf/nginx.conf    
   -2 43906 43905   0  1:57下午 ??         0:00.00 nginx: worker process    
679026792 44385 25034   0  2:29下午 ttys003    0:00.00 grep nginx

11、访问网页

http://localhost

$ curl http://localhost

12、重启

$ sudo ~/soft/openresty/nginx/sbin/nginx -s reload -p ~/soft/openresty/nginx/ -c ~/soft/openresty/nginx/conf/nginx.conf

13、停止

$ sudo ~/soft/openresty/nginx/sbin/nginx -s stop

14、检查nginx配置文件语法是否正确

$ sudo ~/soft/openresty/nginx/sbin/nginx -t


相关内容

    暂无相关文章