Skip to content

Instantly share code, notes, and snippets.

@lcrilly
Last active January 24, 2023 07:09
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lcrilly/959abb619021d6fd4950821d162ec5a8 to your computer and use it in GitHub Desktop.
Save lcrilly/959abb619021d6fd4950821d162ec5a8 to your computer and use it in GitHub Desktop.
NGINX + OpenSSL 3.0

#Testing NGINX with OpenSSL 3.0

  1. Build Docker image
docker build -t nginx:openssl-3.0 .
  1. Run NGINX container
docker run --name ngxos3 -d -p 443:443 -v $PWD:/etc/nginx/conf.d nginx:openssl-3.0
FROM nginx AS build
WORKDIR /src
RUN apt-get update && \
apt-get install -y git gcc make mercurial libperl-dev libpcre3-dev zlib1g-dev libxslt1-dev libgd-ocaml-dev libgeoip-dev
RUN git clone -b openssl-3.0 https://github.com/openssl/openssl openssl-3.0 && \
hg clone https://hg.nginx.org/nginx && \
hg clone http://hg.nginx.org/njs
RUN cd nginx && \
auto/configure `nginx -V 2>&1 | sed "s/ \-\-/ \\\ \n\t--/g" | grep "\-\-" | grep -ve opt= -e param=` \
--with-openssl=../openssl-3.0 --with-debug --add-module=../njs/nginx && \
make
FROM nginx
COPY --from=build /src/nginx/objs/nginx /usr/sbin
EXPOSE 80 443
server {
listen 443 http2 ssl;
ssl_certificate conf.d/foo.example.com.crt;
ssl_certificate_key conf.d/foo.example.com.key;
ssl_protocols TLSv1.3;
ssl_conf_command Ciphersuites TLS_CHACHA20_POLY1305_SHA256;
ssl_early_data on;
root /usr/share/nginx/html;
add_header X-ssl-protocol $ssl_protocol;
add_header X-ssl-curves $ssl_curves;
add_header X-0rtt $ssl_early_data;
}
# vim: syntax=nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment