Webserver with nginx, letsencrypt and fail2ban built-in
100K+
It is based on alpine, leaner, meaner and more up to date
This container sets up an Nginx webserver with a built-in letsencrypt client that automates free SSL server certificate generation and renewal processes.
On unRaid, install from the Community Applications and enter the app folder location, server ports and the email, the domain url and the subdomains (comma separated, no spaces) under advanced view. Note:
DHLEVEL that equals 4096ONLY_SUBDOMAINS that equals trueOn other platforms, you can run this docker with the following command:
docker run -d \
--privileged \
--name="Nginx-letsencrypt" \
-p 80:80 \
-p 443:443 \
-e EMAIL="youremail" \
-e URL="yourdomain.url" \
-e SUBDOMAINS="www,subdomain1,subdomain2" \
-e TZ="America/New_York" \
-v /path/to/config/:/config:rw \
aptalca/nginx-letsencrypt
Replace the EMAIL variable (youremail) with the e-mail address you would like to register the SSL certificate with.
Replace the URL variable (yourdomain.url) with your server's internet domain name, without any subdomains (can also be a dynamic dns url, ie. google.com or username.duckdns.org).
Replace the SUBDOMAINS variable with your choice of subdomains (just the subdomains, comma separated, no spaces).
Replace "America/New_York" with your timezone if different. List of timezones available here: http://php.net/manual/en/timezones.php
Replace the "/path/to/config" with your choice of location.
Make sure that the port 443 in the container is accessible from the outside of your lan. It is OK to map container's port 443 to another port on the host (ie 943) as long as your router will forward port 443 from the outside to port 943 on the host and it will end up at port 443 in the container. If this is confusing, just leave the -p 443:443 portion of the run command as is and forward port 443 on your router to your host IP.
Prior to SSL certificate creation, letsencrypt creates a temporary webserver and checks to see if it is accessible through the domain url provided for validation. Make sure that your server is reachable through your.domain.url:443 and that port 443 is forwarded on your router to the container's port 443 prior to running this docker. Otherwise letsencrypt validation will fail, and no certificates will be generated.
Fail2ban is extremely useful for preventing DDOS attacks or brute force methods that attempt to thwart htpasswd security. Default implementation includes blocking unsuccessful attempts at htpasswd based authentication. You can add more filters by modifying the /config/nginx/jail.local file and dropping the filter files in the /config/nginx/fail2ban-filters folder. Don't forget to restart the container afterwards.
OPTIONAL: If you prefer your dhparams to be 4096 bits (default is 2048), add the following to your run command: -e DHLEVEL="4096"
NOTE: PHP is finally fixed. Switched to using unix:/var/run/php5-fpm.sock. If you're updating an existing install (from prior to the 2016-04-12 build), delete your nginx-fpm.conf file, modify your default site config to utilize unix:/var/run/php5-fpm.sock instead of 127.0.0.1:9000 (as in here: https://github.com/aptalca/docker-webserver/blob/master/defaults/default ) and restart the container
OPTIONAL: If you'd like to generate a cert only for subdomains and not for the url (for instance a cert that covers mail.url.com and ftp.url.com but not url.com), include the following parameter in your run command: -e ONLY_SUBDOMAINS="true"
NOTE: This container recognizes any changes to the parameters entered. If there are changes to the url or domains, it will attempt to revoke the existing certs and generate new ones. Keep in mind that if you change them too many times, letsencrypt will throttle requests and you may be denied new certs for a period of time. Check the logs for suspected throttling.
NOTE: New version automatically creates a pfx key file with every renewal, which you can use for applications such as Emby
You can access your webserver at https://subdomain.yourdomain.url/
--privileged flag is added to the run command. Without it, fail2ban does not work due to inability to modify iptables)Content type
Image
Digest
Size
231.8 MB
Last updated
almost 10 years ago
docker pull aptalca/nginx-letsencrypt