nginx编译安装on mac
一、编译安装模块
如果是原有包中就有的模块,编译时,
./configure --with-xxx 就可以,
如果是第三方模块,可使用 --add-module,
如果有多个模块的话,只需要多次使用-add-module指令即可.
二、下载源码包image_fliter和echo模块
nginx源码下载
http://nginx.org/en/download.html echo模块下载
https://github.com/openresty/echo-nginx-module/tags 解压
gzip -d xxx.tar.gz
tar -zvxf xxx.tar xxx
三.编译
1.安装依赖:
brew install pcre
brew install gd #image filter依赖gd
brew link --force openssl #避免编译openssl时报错
2.cd nginx源码目录
./configure xxx
--prefix 设置编译目录
3.查看原有nginx编译参数
nginx -V
4.添加编译module
./configure \
--with-http_image_filter_module \
--with-debug \
--add-module=/Users/fanfan/web/software/echo-nginx-module-0.61 \
原有编译参数, (注意修改版本目录) ./configure \
--prefix=/usr/local/Cellar/nginx/1.12.2 \
--with-http_ssl_module \
--with-pcre \
--sbin-path=/usr/local/Cellar/nginx/1.12.2/bin/nginx \
--with-cc-opt='-I/usr/local/opt/pcre/include -I/usr/local/opt/openssl@1.1/include' \
--with-ld-opt='-L/usr/local/opt/pcre/lib -L/usr/local/opt/openssl@1.1/lib' \
--conf-path=/usr/local/etc/nginx/nginx.conf \
--pid-path=/usr/local/var/run/nginx.pid \
--lock-path=/usr/local/var/run/nginx.lock \
--http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp \
--http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp \
--http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp \
--http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp \
--http-log-path=/usr/local/var/log/nginx/access.log \
--error-log-path=/usr/local/var/log/nginx/error.log \
--with-http_gzip_static_module --with-http_v2_module \
--with-http_image_filter_module \
--with-debug \
--add-module=/Users/fanfan/web/software/echo-nginx-module-0.61 ------------------------------------------------------------------------------ ./configure --prefix=/usr/local/nginx-1.4.1 --with-http_stub_status_module \
--with-http_realip_module --with-http_image_filter_module --with-debug
5.make
四.安装
1.如果之前未安装nginx
make install
2.如果之前通过brew安装过nginx
/usr/local/bin/nginx /usr/local/Cellar/nginx/xxx/bin/nginx
/usr/local/opt/nginx /usr/local/Cellar/nginx/xxx
修改软连接,直接指向新的nginx
3.替换编译文件的方式
这种方式,只是替换了bin文件,目录还是原来的 #备份原来的binary
cp /usr/local/opt/nginx/bin/nginx /usr/local/opt/nginx/bin/nginx.bak
#先cd到nginx源码目录
sudo cp objs/nginx /usr/local/opt/nginx/bin/nginx
rm /usr/local/bin/nginx
ln -s /usr/local/opt/nginx/bin/nginx /usr/local/bin/nginx
4.建立版本目录方式
$ cp -r /usr/local/Cellar/nginx/1.8.0 /usr/local/Cellar/nginx/1.9.10
#先cd到nginx源码目录
$ sudo cp objs/nginx /usr/local/Cellar/nginx/1.9.10/bin
#更新/usr/local/opt/nginx
$ rm /usr/local/opt/nginx
$ ln -s /usr/local/Cellar/nginx/xxx /usr/local/opt/nginx
#更新/usr/local/bin/nginx
$ rm /usr/local/bin/nginx
$ ln -s /usr/local/opt/nginx/bin/nginx /usr/local/bin/nginx
5.编辑/Library/LaunchDaemons/homebrew.mxcl.nginx.plist
好像也不用编辑
launchctl load -F /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
五.验证nginx
nginx -V / nginx -v yld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib nginx版本依赖 jpeg 8d的版本,而brew install jpeg 的时候,安装的是新版9b
可转换成上一版本即可
brew switch jpeg 8d 或者 因为其他版本安装出现此问题,可重新安装,rebuild source,
这样使用的就是最新版本的依赖
brew cleanup //更新cellar
brew reinstall php71 --build-from-source https://stackoverflow.com/questions/32703296/dyld-library-not-loaded-usr-local-lib-libjpeg-8-dylib-homebrew-php
六.重启nginx
nginx -t //验证配置文件是否正确
有可能会有权限问题,启动时,以root用户启动即可
sudo brew services restart nginx
七.参考链接
https://blog.chionlab.moe/2016/02/02/compile-nginx-on-osx/
https://blog.haohtml.com/archives/12349
nginx编译安装on mac的更多相关文章
- nginx编译安装
Nginx编译安装 1.nginx官网:http://wiki.nginx.org/Install下载:http://nginx.org/en/download.html 2.编译安装# wget h ...
- LNMP平台搭建之一:nginx编译安装
参考博客:https://www.cnblogs.com/zhang-shijie/p/5294162.html jack.zhang 一.环境说明 系统环境:centos6.5 [root@lo ...
- Nginx编译安装lua-nginx-module
lua-nginx-module 模块可以将Lua的强大功能嵌入NGINX服务器. 下载Nginx源码 如果已安装Nginx,需要查看当前安装版本的编译参数: $ /usr/local/nginx/s ...
- Nginx编译安装:
第三方模块 在nginx.org -------- wiki 找 --add-module= 添加 Nginx编译安装: 安装开发环境 ]# yum groupinstall " ...
- [nginx]编译安装及安全优化
nginx配置-最后整理版 nginx_upstream_check_module nginx-module-vts nginx打补丁 nginx编译安装 - 下载 cd /usr/local/src ...
- Linux下nginx编译安装教程和编译参数详解
这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...
- 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装
系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...
- Nginx编译安装第三方模块http_substitutions_filter_module2222
Nginx编译安装第三方模块http_substitutions_filter_module Rming -- 阅读 安装 Http 编译 module filter nginx 模块 >> ...
- Nginx编译安装第三方模块http_substitutions_filter_module
Nginx编译安装第三方模块http_substitutions_filter_module 分类:服务器技术 作者:rming 时间:-- . >>ngx_http_substitu ...
随机推荐
- zabbix3.0.4使用shell脚本和zabbix自带模板两种方法添加对指定进程和端口的监控
zabbix3.0.4添加对进程的监控: 方法一:通过自定义命令进行监控 主要思路: 通过 ps -ef|grep sdk-push-1.0.0.jar |grep -v grep|wc -l 这个命 ...
- 网站遭遇CC及DDOS攻击紧急处理方案
检测访问是否是CC攻击的命令: 80口为网站的访问端口,可以根据实际情况进行修改 # netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: ' ...
- win7 X64系统上 PL/SQL不能识别Oracle实例
电脑系统为Win7 64位,安装的PLSql为64位,安装的Oracle客户端为运行时类型的,应该为32位客户端 电脑上之前安装的32位toad可以识别Oracle实例 在系统添加了oracle_ho ...
- OCM_第九天课程:Section4—》OCM课程环境搭建
注:本文为原著(其内容来自 腾科教育培训课堂).阅读本文注意事项如下: 1:所有文章的转载请标注本文出处. 2:本文非本人不得用于商业用途.违者将承当相应法律责任. 3:该系列文章目录列表: 一:&l ...
- SeaJS入门教程系列之使用SeaJS(二)
SeaJS入门教程系列之使用SeaJS(二) 作者: 字体:[增加 减小] 类型:转载 时间:2014-03-03我要评论 这篇文章主要介绍了SeaJS入门教程系列之使用SeaJS,着重介绍了SeaJ ...
- C++ code:数值计算之矩形法求解积分问题
积分的通常方法是将区域切割成一个个的小矩形,然后求这些小矩形的和.小矩形切割得越细,计算精度就越高,可以将切割小矩形的数量作为循环迭代变量,将前后两个不同精度下的小矩形和之差,作为逼近是否达到要求的比 ...
- Deep Learning系统实训之二:梯度下降原理
基本概念理解: 一个epoch:当前所有数据都跑(迭代)了一遍: 那么两个epoch,就是把所有数据跑了两遍,三个epoch就是把所有数据跑了三遍,以此类推. batch_size:每次迭代多少个数据 ...
- 性能测试六:jmeter进阶之Cookie与header管理器
一.http cookie管理器 可以在浏览器中抓取到cookie信息,然后通过http cookie管理器为http请求添加cookie信息 添加cookie管理器后,Jmeter可以自动处理coo ...
- easyUI拖动课程进课程表
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>拖动 ...
- Math对象的常用属性和方法
属性 描述 Math.PI 返回π(3.1415926) 方法 描述 Math.round() 将数字四舍五入到离它最近的整数 Math.sart(n) 返回平方根,例如Math.sart(9)返回3 ...