nginx模块依赖:nginx的一些模块须要第三方支持,例如gzip模块须要zlib库,rewrite模块须要pcre库,ssl功能须要openssl库。
根据需求添加不一样模块
例添加echo模块:html
详情请看:blog.csdn.net/dushiwodecu…linux
/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复制代码
wget https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz复制代码
tar -zxvf v0.61.tar.gz -C /usr/local/nginxgz复制代码
cd /usr/local/nginxgz/nginx-1.12.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复制代码
make
make install复制代码
server{
server_name echo.chen.com;
listen 80;
location /{
echo "it is echo module...";
}
}复制代码
echo '192.168.1.111 echo.chen.com' >> /etc/hosts复制代码
/usr/local/nginx/sbin/nginx -s reload复制代码
server{
server_name echo.chen.com;
listen 80;
location /{
default_type 'text/html';
echo "it is echo module...";
}
}复制代码
192.168.1.111 echo.chen.com复制代码
/usr/local/nginx/sbin/nginx -s reload复制代码