首页 > 其他 > 详细

实现第三方模块echo使用

时间:2019-06-03 14:01:47      阅读:77      评论:0      收藏:0      [点我收藏+]
实现第三方模块echo使用

1.安装git

[root@localhost ~]# yum install git -y

2.从github上克隆echo模块

[root@localhost ~]# git clone https://github.com/openresty/echo-nginx-module.git

3.编译安装nginx

查看服务器上现有的nginx所带有的相关模块

[root@localhost ~]# nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module

重新编译nginx带上以上模块,再追加一个echo-nginx-module

4.检查当前编译环境及编译所需的工具

[root@localhost nginx-1.14.2]# ./configure --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module --add-module=/root/echo-nginx-module

5.生成指定的模块并复制模块到指定安装目录

[root@localhost nginx-1.14.2]# make && make install

6.重启服务

[root@localhost ~]# systemctl restart nginx

7.测试

修改配置文件

server {
    server_name www.mylinuxops.com;
    location /echo {
        echo "hello world";     # 测试echo模块
 }
}

访问echo页面

[root@localhost ~]# curl  http://www.mylinuxops.com/echo
hello world

实现第三方模块echo使用

原文:https://blog.51cto.com/11886307/2403948

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!