Skip to content

Instantly share code, notes, and snippets.

@c9pr3
Last active July 11, 2019 12:18
Show Gist options
  • Select an option

  • Save c9pr3/5417bba898341c18c205 to your computer and use it in GitHub Desktop.

Select an option

Save c9pr3/5417bba898341c18c205 to your computer and use it in GitHub Desktop.

Revisions

  1. Chris revised this gist Jan 29, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions nginxstaticssl.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    Static linking a shared OpenSSL .a to NGINX 1.9.10 so far got me into some trouble so here we go.
    (Found/Know a better way? Go tell me, I would appreciate it a lot! :-))

    remove package libssl-dev before starting!

    Get openssl, unpack to /tmp
    # with-openssl= breaks it, therefor
    mv /tmp/openssl /usr/pkg # yes, rename it. *dont* move it under pkg/
  2. Chris renamed this gist Jan 29, 2016. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions gistfile1.txt → nginxstaticssl.txt
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,6 @@ cd /tmp/nginx

    create ./fixssl.sh and insert

    '
    OPENSSL_INSTALL_DIR=/opt/my-other-openssl-dir
    OPENSSL_LIB_DIR="$OPENSSL_INSTALL_DIR/lib"

    @@ -24,14 +23,12 @@ do
    sed -e "s|-lcrypto|$OPENSSL_LIB_DIR/libcrypto.so|g" "$FILE" > "$TFILE"
    mv "$TFILE" "$FILE"
    done
    '

    save, close.

    bash fixssl.sh

    './configure --with-ld-opt="-static" --with-debug --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-mail --with-mail_ssl_module --error-log-path=/var/log/nginx.log --http-log-path=/var/log/nginx.access.log --http-client-body-temp-path=/tmp/nginx_client --http-proxy-temp-path=/tmp/nginx_proxy --http-fastcgi-temp-path=/tmp/nginx_fastcgi --without-http_scgi_module --without-http_uwsgi_module --with-stream --with-stream_ssl_module --with-ld-opt="-Wl,--gc-sections" --with-ld-opt="-L/opt/my-other-openssl-dir/lib /opt/my-other-openssl-dir/lib/libssl.a -ldl" --with-ld-opt="-Wl,-s"
    '
    ./configure --with-ld-opt="-static" --with-debug --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-mail --with-mail_ssl_module --error-log-path=/var/log/nginx.log --http-log-path=/var/log/nginx.access.log --http-client-body-temp-path=/tmp/nginx_client --http-proxy-temp-path=/tmp/nginx_proxy --http-fastcgi-temp-path=/tmp/nginx_fastcgi --without-http_scgi_module --without-http_uwsgi_module --with-stream --with-stream_ssl_module --with-ld-opt="-Wl,--gc-sections" --with-ld-opt="-L/opt/my-other-openssl-dir/lib /opt/my-other-openssl-dir/lib/libssl.a -ldl" --with-ld-opt="-Wl,-s"

    make -j 20

  3. Chris revised this gist Jan 29, 2016. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,17 @@
    Static linking a shared OpenSSL .a to NGINX 1.9.10 so far got me into some trouble so here we go.
    (Found/Know a better way? Go tell me, I would appreciate it a lot! :-))

    Get openssl, unpack to /tmp
    # with-openssl= breaks it, therefor
    mv /tmp/openssl /usr/pkg # yes, rename it. *dont* move it under pkg/

    Get nginx, unpack to /tmp
    cd /tmp/nginx

    open ./fixssl.sh and insert
    create ./fixssl.sh and insert

    OPENSSL_INSTALL_DIR=/tmp/openssl
    '
    OPENSSL_INSTALL_DIR=/opt/my-other-openssl-dir
    OPENSSL_LIB_DIR="$OPENSSL_INSTALL_DIR/lib"

    for FILE in "auto/lib/sha1/conf" "auto/lib/md5/conf" "auto/lib/openssl/conf"
    @@ -18,9 +24,16 @@ do
    sed -e "s|-lcrypto|$OPENSSL_LIB_DIR/libcrypto.so|g" "$FILE" > "$TFILE"
    mv "$TFILE" "$FILE"
    done
    '

    save, close.

    bash fixssl.sh

    ./configure --with-ld-opt="-static" --with-debug --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-mail --with-mail_ssl_module --error-log-path=/var/log/nginx.log --http-log-path=/var/log/nginx.access.log --http-client-body-temp-path=/tmp/nginx_client --http-proxy-temp-path=/tmp/nginx_proxy --http-fastcgi-temp-path=/tmp/nginx_fastcgi --without-http_scgi_module --without-http_uwsgi_module --with-stream --with-stream_ssl_module --with-ld-opt="-Wl,--gc-sections" --with-ld-opt="-L/tmp/openssl/lib /tmp/openssl/lib/libssl.a -ldl" --with-ld-opt="-Wl,-s" --with-openssl=/tmp/openssl
    './configure --with-ld-opt="-static" --with-debug --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-mail --with-mail_ssl_module --error-log-path=/var/log/nginx.log --http-log-path=/var/log/nginx.access.log --http-client-body-temp-path=/tmp/nginx_client --http-proxy-temp-path=/tmp/nginx_proxy --http-fastcgi-temp-path=/tmp/nginx_fastcgi --without-http_scgi_module --without-http_uwsgi_module --with-stream --with-stream_ssl_module --with-ld-opt="-Wl,--gc-sections" --with-ld-opt="-L/opt/my-other-openssl-dir/lib /opt/my-other-openssl-dir/lib/libssl.a -ldl" --with-ld-opt="-Wl,-s"
    '

    make -j 20

    # objdump -p objs/nginx|grep NEEDED|grep -i ssl
    NEEDED libssl.so.1.0.0
  4. Chris created this gist Jan 29, 2016.
    26 changes: 26 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    Get openssl, unpack to /tmp

    Get nginx, unpack to /tmp
    cd /tmp/nginx

    open ./fixssl.sh and insert

    OPENSSL_INSTALL_DIR=/tmp/openssl
    OPENSSL_LIB_DIR="$OPENSSL_INSTALL_DIR/lib"

    for FILE in "auto/lib/sha1/conf" "auto/lib/md5/conf" "auto/lib/openssl/conf"
    do
    TFILE=`mktemp /tmp/fix.XXXXXXXXXX`
    sed -e "s|-lssl|$OPENSSL_LIB_DIR/libssl.so|g" "$FILE" > "$TFILE"
    mv "$TFILE" "$FILE"

    TFILE=`mktemp /tmp/fix.XXXXXXXXXX`
    sed -e "s|-lcrypto|$OPENSSL_LIB_DIR/libcrypto.so|g" "$FILE" > "$TFILE"
    mv "$TFILE" "$FILE"
    done

    save, close.

    bash fixssl.sh

    ./configure --with-ld-opt="-static" --with-debug --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-pcre --with-mail --with-mail_ssl_module --error-log-path=/var/log/nginx.log --http-log-path=/var/log/nginx.access.log --http-client-body-temp-path=/tmp/nginx_client --http-proxy-temp-path=/tmp/nginx_proxy --http-fastcgi-temp-path=/tmp/nginx_fastcgi --without-http_scgi_module --without-http_uwsgi_module --with-stream --with-stream_ssl_module --with-ld-opt="-Wl,--gc-sections" --with-ld-opt="-L/tmp/openssl/lib /tmp/openssl/lib/libssl.a -ldl" --with-ld-opt="-Wl,-s" --with-openssl=/tmp/openssl