Ubuntu下Nginx源码编译
来源:互联网 发布:数据库信息如何填写 编辑:程序博客网 时间:2024/06/18 12:04
Nginx源码下载地址:
http://nginx.org/en/download.html
解压命令 tar -zxvf nginx-1.8.1.tar.gz
安装依赖库:
1.PCRE
# apt-get update
# apt-get install libpcre3 libpcre3-dev
2.ZLIB
sudo apt-get install zlib1g-dev
3.openssl
sudo apt-get install openssl
然后./configure,后面暂时不用参数,
结果会有
OpenSSL library is not used
sha1 library is not found
这个暂时不影响编译,Makefile能够正常生成。
最后make&&make install,看有没有权限问题,加上sudo就行
最后nginx目录是默认在/usr/local/nginx/下面
编译模块的动态链接库:(需要Nginx1.9以上版本支持)
./configure --add-dynamic-module=/opt/source/ngx_my_module/
$ make -f objs/Makefile modules
或者$ make modules两个make命令是等价的,其中/opt/source/ngin_my_module/最好填写为绝对路径,不然可能报Nginx error, no config found
最后编译出来,so文件会出现在objs文件夹下面。
要使用so,在nginx.conf开头加上
load_module modules/ngx_my_module.so;
即可。
旧风格的config文件如下
ngx_addon_name=ngx_http_response_moduleHTTP_MODULES="$HTTP_MODULES ngx_http_response_module"NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_response_module.c"新风格如下
ngx_addon_name=ngx_http_response_moduleif test -n "$ngx_module_link"; then ngx_module_type=HTTP ngx_module_name=ngx_http_response_module ngx_module_srcs="$ngx_addon_dir/ngx_http_response_module.c" . auto/moduleelse HTTP_MODULES="$HTTP_MODULES ngx_http_response_module" NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_response_module.c"fi新的方式利用“auto/module"脚本来建立许多事物,即新的方式可以用于动态模块和静态模块。
阅读全文
0 0
- Ubuntu下Nginx源码编译
- Ubuntu 14.10下源码编译安装Nginx 1.8.0
- Ubuntu下编译源码
- Ubuntu下Nginx编译安装
- Ubuntu下源码安装Nginx
- ubuntu linux 源码编译安装NGINX
- Ubuntu nginx php7 源码编译安装
- Ubuntu下编译Android源码
- ubuntu下编译VLC源码
- Ubuntu下编译vlc源码
- unp ubuntu下源码编译
- ubuntu下编译android源码
- Ubuntu下编译android源码
- Ubuntu下源码编译CodeBlocks
- ubuntu下编译VLC源码
- Ubuntu下编译lua源码
- ubuntu下编译unp源码
- ubuntu 下编译内核源码
- 将导入arcgis的Excel中的坐标点转成与影像一样的投影
- Blocks (矩阵快速幂)
- 最大子图形问题详解
- Do more with less
- 洋葱架构简介——分离是为了更好的结合
- Ubuntu下Nginx源码编译
- Unity3D开发之获取物体的尺寸
- 学习记录
- poj1364(91/600)
- 欧拉函数知识点及其求法模板
- android studio 降低编译版本出错
- 数字增益和模拟增益
- 在linux上使用yum安装JDK
- HDU 6096 String (字典树, 2017 Multi-Univ Training Contest 6)