Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make lua-openssl support nginx+lua-nginx-module #196

Open
zhaozg opened this issue Oct 29, 2019 · 2 comments
Open

Make lua-openssl support nginx+lua-nginx-module #196

zhaozg opened this issue Oct 29, 2019 · 2 comments

Comments

@zhaozg
Copy link
Owner

zhaozg commented Oct 29, 2019

Work breakdown:

    • nginx + nginx-lua-module + lua-openssl without https/tls support
    • nginx + nginx-lua-module + lua-openssl with https/tls support
    • openresty + lua-openssl start without https
    • openresty + lua-openssl start with https
    • tengine + lua-openssl
    • coexist with other crypto/ssl libs
@zhaozg
Copy link
Owner Author

zhaozg commented Oct 29, 2019

 ⚙ zhaozg@zhaozgMBP  /usr/local/openresty/nginx/sbin  ./nginx -V
nginx version: openresty/1.17.4.1rc0
built by clang 11.0.0 (clang-1100.0.33.8)
built with OpenSSL 1.0.2u-dev  xx XXX xxxx
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.15 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.7 --with-ld-opt=-Wl,-rpath,/usr/local/Cellar/luajit/HEAD-f0e865d/lib --with-openssl=/Users/zhaozg/work/product/openssl/openssl --with-openssl-opt=-DOPENSSL_CCSTC --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module
 ⚙ zhaozg@zhaozgMBP  /usr/local/openresty/nginx/sbin  ./nginx -s reload
2019/10/29 21:42:17 [notice] 69047#0: signal process started
2019/10/29 21:42:17 [alert] 61866#0: detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
2019/10/29 21:42:17 [error] 61866#0: [lua] init_by_lua:5: 0.7.7Lua 5.1OpenSSL 1.0.2t-dev  xx XXX xxxx
2019/10/29 21:42:17 [error] 69053#0: *26 [lua] init_worker_by_lua:5: 0.7.7Lua 5.1OpenSSL 1.0.2t-dev  xx XXX xxxx, context: init_worker_by_lua*

#user  nobody;
worker_processes  8;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    init_by_lua_block {
        local openssl = require("openssl")
        local log = ngx.log
        local ERR = ngx.ERR
        log(ERR,openssl.version())
    }

    init_worker_by_lua_block {
        local openssl = require("openssl")
        local log = ngx.log
        local ERR = ngx.ERR
        log(ERR,openssl.version())
    }

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  localhost;

        ssl_certificate      server.crt;
        ssl_certificate_key  server.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }

}

@zhaozg
Copy link
Owner Author

zhaozg commented Oct 30, 2019

#169
#72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant