A basic public nginx 1.x container. It is configured to provide both HTTP and/or HTTPS connections.
/app/public
must be a mounted volume and be the webroot.fpm
must be a linked container providing the PHP-FPM service for thephp
andphp-ssl
images./etc/ssl/public/app.crt
must be a mounted volume for thephp-ssl
andstatic-ssl
images./etc/ssl/private/app.key
must be a mounted volume for thephp-ssl
andstatic-ssl
images./etc/ssl/private/dhparam.pem
must be a mounted volume for thephp-ssl
andstatic-ssl
images.
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"