nginx–基础–3.11–案例–安装echo模块


1、介绍

1.1、echo模块好处

echo模块便于测试nginx.conf里面的代码

1.2、下载echo模块

git clone https://gitee.com/yaowenqiang/echo-nginx-module.git

我们已经下载好了,且打包为压缩文件

在这里插入图片描述

2、安装nginx

2.1、解压

tar -zxvf echo-nginx-module.tar.gz -C /root/

2.2、安装nginx的时候,添加上echo模块


# 安装,且添加各种模块 
./configure --prefix=/usr/local/nginx 
--with-select_module 
--with-http_ssl_module  
--with-http_realip_module 
--with-http_addition_module 
--with-http_sub_module 
--with-http_gzip_static_module  
--with-http_stub_status_module 
--with-http_gunzip_module 
--with-http_v2_module 
--with-stream 
# 添加上echo模块
--add-module=/root/echo-nginx-module

3、测试

3.1、配置文件

user  root; 
worker_processes  auto; 
error_log  logs/error.log; 
pid        logs/nginx.pid;  
worker_rlimit_nofile 65535;
events { 
    use epoll; 
    worker_connections  65535;
}

http {
	# 文件扩展名与文件类型映射表
    include       mime.types;
	# 默认文件类型,默认为text/plain
    default_type  application/octet-stream;
 

    server {
        listen       80;
        server_name  localhost; 
		# 重点
		location /test/ { 
			 echo "hello world"; 
        }
 
    }
}

3.2、测试

在这里插入图片描述

更多推荐