Nginx
Is an asynchronous web server that is focused on concurrency and performance. For example, Nginx is sitting in-front of our application and when user requests an image, it redirects the request to server with static resources. Which means, it does not bother our application at all.
Lets create nginx docker container.
Docker file.
FROM nginx:1.9
MAINTAINER Ondrej Kvasnovsky <ondrej.kvasnovsky@gmail.com>
RUN rm /usr/share/nginx/html/*
COPY configs/nginx.conf /etc/nginx/nginx.conf
COPY configs/default.conf /etc/nginx/conf.d/default.conf
COPY certs/productionexample.crt /etc/ssl/certs/productionexample.crt
COPY certs/productionexample.key /etc/ssl/private/productionexample.key
COPY certs/dhparam.pem /etc/ssl/private/dhparam.pem
COPY docker-entrypoint /
RUN chmod +x /docker-entrypoint
ENTRYPOINT ["/docker-entrypoint"]
CMD ["nginx", "-g", "daemon off;"]We can get all the files here.
configs/nginx.conf provides basic configuration of nginx.
configs/default.conf makes sure that requests are properly redirected.
docker-entrypoint when we run this, it will make sure we get proper nginx configuration for other environments.
Generate self signed certificates
Here is a sample how we can create self-signed certificates.
Diffie Hellman key.
Last updated
Was this helpful?