nginx安装mysql和json模块,在nginx中直接连接mysql,并获取mysql中的数据,并把获取的数据返回json数据到浏览器中,不用再通过php-fpm或lua去连接数据库,提高web的性能。下面是安装过程。
系统centos7,nginx版本1.14.0,已安装好nginx中新增加模块。
一、安装nginx
二、nginx安装mysql和json模块
1.mysql模块下载
git clone https://github.com/openresty/drizzle-nginx-module.git
ls
drizzle-nginx-module
#复制到nginx模块目录下
cp -R drizzle-nginx-module/ /usr/local/nginx/module
#下载好mysql模块后还需要安装模块的drizzle类库,不安装会报错 ./configure: error: the ngx_drizzle addon requires the libdrizzle library.
http://openresty.org/download/drizzle7-2011.07.21.tar.gztar xzvf drizzle7-2011.07.21.tar.gz
cd drizzle7-2011.07.21/
./configure --without-server
make libdrizzle-1.0
<