A basic public nginx 1.x container. It is configured to provide both HTTP and/or HTTPS connections.
/app/publicmust be a mounted volume and be the webroot.fpmmust be a linked container providing the PHP-FPM service for thephpandphp-sslimages./etc/ssl/public/app.crtmust be a mounted volume for thephp-sslandstatic-sslimages./etc/ssl/private/app.keymust be a mounted volume for thephp-sslandstatic-sslimages./etc/ssl/private/dhparam.pemmust be a mounted volume for thephp-sslandstatic-sslimages.
We use the c4tech/generic-data image to provide app as a linked volume.
Also, c4tech/laravel-fpm is what we use for our PHP-FPM service.
To generate the dhparam.pem file, run:
openssl dhparam -out dhparam.pem 4096
For the SSL certificate and key, you can generate a CSR and key, then submite the CSR to a certificate provider who will provide the certificate.
openssl req -nodes -new -newkey rsa:4096 -keyout server.key -out server.csr -sha256
Alternatively, you can create a self-signed SSL certificate:
openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 3650 -nodes -sha256
www:
image: c4tech/nginx:php-ssl
volumes:
- ./:/app
- ./ssl/server.crt:/etc/ssl/public/app.crt
- ./ssl/server.key:/etc/ssl/private/app.key
- ./ssl/dhparam.pem:/etc/ssl/private/dhparam.pem
links:
- fpm
ports:
- "80:80"
- "443:443"