Skip to content

Latest commit

 

History

History

part30-ssl-certification-with-nginx

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Ansible LEMP stack on Debian 11

This playbook will activate ssl certification with lets encrypt free certification with http-01 acme_method and in nginx web server

Settings in group_vars/all:

acme_directory: A directory will be created with this name in: /var/www/
acme_version: version of acme
acme_revoke: Boolean varible that control revoking previous amce certification
acme_register_account: The password for the MySQL root account.
acme_account_email: The email that use to verify the domain by lets encrypt
project_path: The path where the project exist on server

letsencrypt_dir: The main directory the letsencrypt generate the data
letsencrypt_keys_dir: Letsencrypt keys directory
letsencrypt_csrs_dir: Letsencrypt CSRS key directory
letsencrypt_certs_dir: Letsencrypt CERT key directory
letsencrypt_account_key: Letsencrypt ACCOUNT key
letsencrypt_account_dir: Letsencrypt ACCOUNT directory
acme_domain: The domain that want to activate the ssl.

Run the Playbook:

ansible-playbook -l [target] -i [inventory file] -u [remote user] lemp.yml

nginx config

add this line to nginx config file and restart it

 ssl_certificate /etc/letsencrypt/{{acme_domain}}/certs/{{acme_domain}}-fullchain.pem; # Adjust path as necessary
 ssl_certificate_key /etc/letsencrypt/{{acme_domain}}/keys/{{acme_domain}}.key; # Adjust path as necessary