Docker compose configuration for production server using nginx-proxy and Let's Encrypt proxy companion.
Create a docker network named nginx-proxy-network.
docker network create --driver bridge nginx-proxy-network
Run the service inside nginx-proxy directory.
docker compose up -d
Run your web server container by adding environment variables VIRTUAL_HOST, VIRTUAL_PORT, LETSENCRYPT_HOST, and LETSENCRYPT_EMAIL. This is an example using laravel-docker-image.
docker run -d \
--name your.domain.com \
-v /path/to/your/web/project:/var/www/html \
-e VIRTUAL_HOST=your.domain.com \
-e VIRTUAL_PORT=8080 \
-e LETSENCRYPT_HOST=your.domain.com \
-e [email protected] \
zydhanlinnar11/laravel-docker-image
Your CA certificate and SSL certificate will be generated under certs
directory.