@adonia
2018-05-25T06:18:43.000000Z
字数 3090
阅读 161
nginx
nginx如需支持lua,需要在编译nginx源码时指定支持lua的module。这里直接使用OpenResty。
docker pull openresty/openresty
docker run --rm -d openresty/openresty
,启动完成后,可以执行docker exec -ti 35f9db1cb096 /bin/sh
进入docker容器中,查看openresty的目录结构。
/usr/local/openresty # ls -l
total 188
drwxr-xr-x 2 root root 4096 Nov 18 2016 bin
drwxr-xr-x 6 root root 4096 Nov 18 2016 luajit
drwxr-xr-x 6 root root 4096 Nov 18 2016 lualib
drwxr-xr-x 13 root root 4096 May 24 05:13 nginx
drwxr-xr-x 43 root root 4096 Nov 18 2016 pod
-rw-r--r-- 1 root root 165176 Nov 18 2016 resty.index
drwxr-xr-x 5 root root 4096 Nov 18 2016 site
nginx的目录结构:
/usr/local/openresty/nginx # ls -l
total 40
drwx------ 2 nobody root 4096 May 24 05:13 client_body_temp
drwxr-xr-x 2 root root 4096 Nov 18 2016 conf
drwx------ 2 nobody root 4096 May 24 05:13 fastcgi_temp
drwxr-xr-x 2 root root 4096 Nov 18 2016 html
drwxr-xr-x 2 root root 4096 May 24 05:13 logs
drwxr-xr-x 2 root root 4096 Nov 18 2016 modules
drwx------ 2 nobody root 4096 May 24 05:13 proxy_temp
drwxr-xr-x 2 root root 4096 Nov 18 2016 sbin
drwx------ 2 nobody root 4096 May 24 05:13 scgi_temp
drwx------ 2 nobody root 4096 May 24 05:13 uwsgi_temp
docker cp 35f9db1cb096:/usr/local/openresty/nginx/conf .
docker stop 35f9db1cb096
docker run --rm -d -p 8080:80 --volume $PWD/conf:/usr/local/openresty/nginx/conf --volume $PWD/log:/var/log/nginx --volume $PWD/html:/usr/share/nginx/html openresty/openresty
docker exec 9f7b0561b6cd /usr/local/openresty/nginx/sbin/nginx -V
nginx version: openresty/1.11.2.2
built by gcc 5.3.0 (Alpine 5.3.0)
built with OpenSSL 1.0.2j 26 Sep 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.7 --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.17 --add-module=../redis2-nginx-module-0.13 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-openssl=/tmp/openssl-1.0.2j --with-pcre=/tmp/pcre-8.39 --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-ipv6 --with-mail --with-mail_ssl_module --with-md5-asm --with-pcre-jit --with-sha1-asm --with-stream --with-stream_ssl_module --with-threads
--add-module=../ngx_lua-0.10.7 --add-module=../ngx_lua_upstream-0.06
即启动支持lua的module/usr/local/openresty/nginx/sbin/nginx
为openresty中nginx的启动入口。