openresty 如何添加模塊

一、先看看你要安裝的模塊是否已經存在了java

$  /opt/openresty/nginx/sbin/nginx -V  (V大寫) 結果以下:
nginx version: openresty/1.7.10.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/opt/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.2.19 --add-module=../echo-nginx-module-0.58 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.29 --add-module=../form-input-nginx-module-0.11 --add-module=../encrypted-session-nginx-module-0.04 --add-module=../srcache-nginx-module-0.30 --add-module=../ngx_lua-0.9.16 --add-module=../ngx_lua_upstream-0.03 --add-module=../headers-more-nginx-module-0.26 --add-module=../array-var-nginx-module-0.04 --add-module=../memc-nginx-module-0.16 --add-module=../redis2-nginx-module-0.12 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.06 --with-ld-opt=-Wl,-rpath,/opt/openresty/luajit/lib --user=nginx --group=nginx --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module

 

我想安裝nginx_concat_module模塊,SVN 下載到指定的目錄 /usr/local/src/nginx_modulenginx

 svn checkout http://code.taobao.org/svn/nginx_concat_module/trunk/  $NGINX_CONCAT_MODULE

 

先進入openresty的源碼文件夾下redis

$ cd /usr/local/src/ngx_openresty-1.7.10.2

    添加模塊,--add-module=路徑shell

./configure --prefix=/opt/openresty --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --add-module=/usr/local/src/nginx_module/nginx_concat_module

    結果:執行過程省略了json

Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library
  nginx path prefix: "/opt/openresty/nginx"
  nginx binary file: "/opt/openresty/nginx/sbin/nginx"
  nginx configuration prefix: "/opt/openresty/nginx/conf"
  nginx configuration file: "/opt/openresty/nginx/conf/nginx.conf"
  nginx pid file: "/opt/openresty/nginx/logs/nginx.pid"
  nginx error log file: "/opt/openresty/nginx/logs/error.log"
  nginx http access log file: "/opt/openresty/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
cd ../..
Type the following commands to build and install:
    gmake
    gmake install

好了,編譯執行完成了,接下來執行make操做(若是是新安裝則執行make install):session

$ make

若是執行沒有報錯則進入objs文件夾中xss

$ cd /usr/local/src/ngx_openresty-1.7.10.2/build/nginx-1.7.10/objs

經過命令能夠看到 nginx文件,它是剛剛從新生成的,若是在make以前看過這裏就知道這個文件剛剛沒有,再嘗試用 -V命令看看其配置如何:svn

./nginx -V
configure arguments: --prefix=/opt/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.2.19 --add-module=../echo-nginx-module-0.58 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.29 --add-module=../form-input-nginx-module-0.11 --add-module=../encrypted-session-nginx-module-0.04 --add-module=../srcache-nginx-module-0.30 --add-module=../ngx_lua-0.9.16 --add-module=../ngx_lua_upstream-0.03 --add-module=../headers-more-nginx-module-0.26 --add-module=../array-var-nginx-module-0.04 --add-module=../memc-nginx-module-0.16 --add-module=../redis2-nginx-module-0.12 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.06 --with-ld-opt=-Wl,-rpath,/opt/openresty/luajit/lib --user=nginx --group=nginx --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module

 

將生成的新nginx文件複製到你的安裝目錄ui

 cp /usr/local/src/ngx_openresty-1.7.10.2/build/nginx-1.7.10/objs/nginx ./openresty/nginx/sbin/
相關文章
相關標籤/搜索