Nginx 动态添加模块
来源:互联网 发布:奥拉星拥有全知之眼 编辑:程序博客网 时间:2024/06/05 17:17
Nginx 动态添加模块
nginx模块依赖:nginx的一些模块需要第三方支持,例如gzip模块需要zlib库,rewrite模块需要pcre库,ssl功能需要openssl库。
根据需求添加不同模块
例添加echo模块:
1.下载并安装nginx
详情请看:http://blog.csdn.net/dushiwodecuo/article/details/78393454
2.查看nginx已安装的模块
/usr/local/nginx/sbin/nginx -V
- 旧版本模块
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre
3.选择与nginx版本所符合的模块版本
echo:https://github.com/openresty/echo-nginx-module/tags
当前nginx版本为:1.12.2,选择echo版本为0.61
4.下载模块
wget https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz
5.解压模块
tar -zxvf v0.61.tar.gz -C /usr/local/nginxgz
6.为nginx添加模块
6.1.切换到nginx的源码目录(即解压后的目录)
cd /usr/local/nginxgz/nginx-1.12.2
6.2.添加新模块
./configure --prefix=/usr/local/nginx --add-module=/usr/local/nginxgz/echo-nginx-module-0.61 --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-pcre
7.重新编译
makemake install
8.测试
- Linux上的测试
8.1.修改配置文件
8.1.1.修改nginx.conf,添加测试域名模块
server{ server_name echo.chen.com; listen 80; location /{ echo "it is echo module..."; } }
8.1.2.修改Linux host文件
echo '192.168.1.111 echo.chen.com' >> /etc/hosts
8.2.重启nginx
/usr/local/nginx/sbin/nginx -s reload
- 注:若是重启nginx之后还没能访问到,直接reboot,重启虚拟机等即可
8.3.访问测试
- Windows上浏览器测试
8.1.修改配置文件
8.1.1.修改nginx.conf,添加测试域名模块
server{ server_name echo.chen.com; listen 80; location /{ default_type 'text/html'; echo "it is echo module..."; } }
- 注: 如果没有这个default_type,浏览器访问则会一直下载文件而不是输出在浏览器上
8.1.2.修改Windows host文件
192.168.1.111 echo.chen.com
8.2.重启nginx
/usr/local/nginx/sbin/nginx -s reload
- 注:若是重启nginx之后还没能访问到,直接reboot,重启虚拟机等即可
8.3.测试访问浏览器
阅读全文
1 0
- Nginx 动态添加模块
- 已安装nginx动态添加模块
- 已安装nginx动态添加模块
- Linux下,Nginx的安装、升级及动态添加模块
- Nginx系列—动态添加第三方模块
- nginx 添加C++模块
- (转)nginx添加模块
- nginx添加模块
- nginx重新添加模块
- nginx添加tcp模块
- Nginx 模块添加
- NGINX添加subs_filter模块
- nginx添加模块
- nginx平滑添加模块
- Nginx 模块添加
- nginx添加模块
- nginx添加fastdfs模块
- nginx添加https模块
- lnmp启动
- 绝对路径和相对路径
- 分布式事务之说说TCC事务
- Python3做采集
- 更换域名图标
- Nginx 动态添加模块
- 创客派邀请码
- android 常用权限和依赖
- Linux成长之路
- Python爬虫入门:Cookie的使用
- 智能指针管理通过new创建的对象
- mybatis初步学习
- 工具
- Python3.5——多进程