yum install pcre-devel.x86_64
方法一html
一、安装 libdrizzle 1.0mysql
[root@lhj ~]# wget http://agentzh.org/misc/nginx/drizzle7-2011.07.21.tar.gz
[root@lhj ~]# tar zxvf drizzle7-2011.07.21.tar.gz
[root@lhj ~]# cd drizzle7-2011.07.21
[root@lhj drizzle7-2011.07.21]# ./configure --without-server
[root@lhj drizzle7-2011.07.21]# make libdrizzle-1.0
[root@lhj drizzle7-2011.07.21]# make install-libdrizzle-1.0
二、安装 OpenRestynginx
[root@lhj ngx_openresty-1.2.4.14]# ./configure --prefix=/usr/local/openresty --with-luajit --with-http_drizzle_module --with-libdrizzle=/usr/local [root@lhj ngx_openresty-1.2.4.14]# gmake [root@lhj ngx_openresty-1.2.4.14]# gmake install
编辑 nginx.conf 配置文件sql
http { upstream mysql { drizzle_server 127.0.0.1:3306 dbname=test user=root password=root protocol=mysql; } server { location = /mysql-status { drizzle_status; } location / { drizzle_pass mysql; drizzle_query "select id,username,age from users where id=1"; rds_json on; } } }
红色的配置用到了 HttpDrizzleModule 和 rds-json-nginx-module 模块,前一个模块是用来和数据库交互的,后面那个是作数据格式转换的,这里使用的是 json 数据格式数据库