2019-05-19 15:11:11 +00:00
< span class = "step" ng-if = "activeStep === 'download'" > <!--
2018-11-20 13:12:25 +00:00
2019-05-19 15:11:11 +00:00
step: download
2018-11-20 13:12:25 +00:00
2019-05-19 17:37:52 +00:00
-->< span class = "hljs-comment" > < span class = "counter" > .< / span > < strong > Download< / strong > generated config:< / span > < strong > < a href = "#" ng-click = "downloadZip()" > nginxconfig.io-{{ getDomains().join(',') }}.zip< / a > < / strong >
2019-06-05 15:20:21 +00:00
< span class = "hljs-comment" > < strong > Upload< / strong > to server's< / span > < strong > {{ data.directory_nginx.replace(endingSlashRegex, '') }}< / strong > < span class = "hljs-comment" > directory< / span >
2019-05-19 17:37:52 +00:00
< span class = "hljs-comment" > - OR -< / span >
2019-06-05 15:03:33 +00:00
< span class = "hljs-comment" > < strong > Copy< / strong > as Base64 string:< / span > < strong > < a href = "#" ng-mouseenter = "prepareBase64()" ng-click = "copyAsBase64()" ngclipboard data-clipboard-target = "#base64-zip-line" ngclipboard-success = "clipboardSuccess('base64-zip-line')" > Copy to clipboard< / a > < / strong > < span class = "hljs-comment small" > (echo 'BASE64' | base64 --decode > {{ data.directory_nginx }}nginxconfig.io-{{ getDomains().join(',') }}.zip)< / span >
2019-05-19 17:37:52 +00:00
< span class = "hljs-comment" > < strong > Paste< / strong > from clipboard and run the command< / span >
< span class = "hljs-comment" > < span class = "counter" > .< / span > Go to NGINX directory (over SSH):< / span >
2019-06-05 15:20:21 +00:00
< span class = "hljs-section" > cd< / span > {{ data.directory_nginx.replace(endingSlashRegex, '') }}
2019-05-19 15:11:11 +00:00
< span class = "hljs-comment" > < span class = "counter" > .< / span > Backup current configuration:< / span >
< span class = "hljs-section" > tar< / span > < span class = "hljs-attribute" > -czvf< / span > nginx_$(date +'%F_%H-%M-%S').tar.gz nginx.conf sites-available/ sites-enabled/ nginxconfig.io/
< span class = "hljs-comment" > < span class = "counter" > .< / span > Unzip the uploaded archive:< / span >
< span class = "hljs-section" > unzip< / span > < span class = "hljs-attribute" > -o< / span > nginxconfig.io-{{ getDomains().join(',') }}.zip < span class = "hljs-comment" > (you probably need to install < strong > unzip< / strong > :< / span > < span class = "hljs-section" > < / span > < strong > sudo< / strong > < span class = "hljs-section" > apt-get< / span > < span class = "hljs-attribute" > install< / span > unzip< span class = "hljs-comment" > )< / span > < / span > <!--
2018-11-20 13:12:25 +00:00
2019-05-19 15:11:11 +00:00
-->< span class = "step" ng-if = "activeStep === 'ssl'" > <!--
2018-11-20 13:12:25 +00:00
2019-05-19 15:11:11 +00:00
step: ssl
2018-02-21 00:54:13 +00:00
2019-05-19 15:11:11 +00:00
--><!--
2018-02-18 13:02:11 +00:00
2019-05-19 15:11:11 +00:00
✔ SSL DH required -->< span ng-if = "isSSLDHRequired()" > < span class = "hljs-comment" > < span class = "counter" > .< / span > Generate Diffie-Hellman keys:< / span >
2019-06-17 12:46:39 +00:00
< span class = "hljs-section" > openssl< / span > < span class = "hljs-attribute" > dhparam< / span > < span class = "hljs-attribute" > -out< / span > {{ data.directory_nginx }}dhparam.pem < span class = "hljs-number" > {{ sslProfiles[ data.ssl_profile ].dh_param_size }}< / span >
2019-05-19 15:11:11 +00:00
< / span > <!--
2018-02-21 00:54:13 +00:00
2019-05-19 15:11:11 +00:00
✔ Let's Encrypt
-->< span ng-if = "hasCertLetsEncrypt()" > < span class = "hljs-comment" > < span class = "counter" > .< / span > Create a common ACME-challenge directory (for Let's Encrypt):< / span >
2019-06-05 15:20:21 +00:00
< span class = "hljs-section" > mkdir< / span > < span class = "hljs-attribute" > -p< / span > {{ data.directory_letsencrypt.replace(endingSlashRegex, '') }}
2019-07-07 16:58:33 +00:00
< span class = "hljs-section" > chown< / span > < span class = "hljs-attribute" > {{ data.user }}< / span > {{ data.directory_letsencrypt.replace(endingSlashRegex, '') }}< / span > < / span > <!--
2018-02-21 00:54:13 +00:00
2018-02-18 13:02:11 +00:00
2019-05-19 15:11:11 +00:00
-->< span class = "step" ng-if = "activeStep === 'certbot'" > <!--
2019-01-06 14:48:28 +00:00
2019-05-19 15:11:11 +00:00
step: certbot
2019-01-06 14:48:28 +00:00
2019-05-19 15:11:11 +00:00
-->< span class = "hljs-comment" > < span class = "counter" > .< / span > Comment out SSL related directives in configuration:< / span >
< span class = "hljs-section" > sed< / span > < span class = "hljs-attribute" > -i -r< / span > 's/(listen .*443)/\1;#/g; s/(ssl_(certificate|certificate_key|trusted_certificate) )/#;#\1/g'< span ng-if = "isUnified()" > <!--
2019-06-05 15:03:33 +00:00
--> {{ data.directory_nginx }}nginx.conf< / span > < span ng-if = "isModularized()" > < span ng-repeat = "(_site, _domain) in getDomains() track by $index" ng-if = "isCertLetsEncrypt(_site)" > <!--
--> {{ data.directory_nginx }}sites-{{ isSymlink() ? 'available' : 'enabled' }}/{{ _domain }}.conf< / span > < / span >
2019-05-19 19:32:36 +00:00
< span class = "hljs-comment" > < span class = "counter" > .< / span > Reload < strong > NGINX< / strong > :< / span >
< strong > sudo< / strong > < span class = "hljs-section" > nginx< / span > < span class = "hljs-attribute" > -t< / span > & & < strong > sudo< / strong > < span class = "hljs-section" > systemctl< / span > < span class = "hljs-attribute" > reload< / span > nginx
2019-05-19 15:11:11 +00:00
< span class = "hljs-comment" > < span class = "counter" > .< / span > Obtain certificate{{ getDomains().length > 1 ? 's' : '' }}:< / span > <!--
2019-01-06 14:48:28 +00:00
-->< span ng-repeat = "(_site, _domain) in getDomains() track by $index" ng-if = "isCertLetsEncrypt(_site)" >
2019-05-19 15:11:11 +00:00
< span class = "hljs-section" > certbot< / span > <!--
-->< span class = "hljs-attribute" > certonly< / span > <!--
2018-03-10 11:33:23 +00:00
-->< span class = "hljs-attribute" > --webroot< / span > <!--
2019-05-19 15:11:11 +00:00
-->< span ng-if = "isNonWWW(_site) || isRedirect(_site)" > < span class = "hljs-attribute" tooltips tooltip-template = "--domain" tooltip-side = "top" > -d< / span > {{ _domain }} < / span > <!--
-->< span ng-if = "isWWW(_site) || isRedirect(_site)" > < span class = "hljs-attribute" tooltips tooltip-template = "--domain" tooltip-side = "top" > -d< / span > www.{{ _domain }} < / span > <!--
-->< span ng-if = "isCDN(_site)" > < span class = "hljs-attribute" tooltips tooltip-template = "--domain" tooltip-side = "top" > -d< / span > cdn.{{ _domain }} < / span > <!--
2019-02-26 09:02:43 +00:00
-->< span class = "hljs-attribute" > --email< / span > {{ data.sites[_site].email ? data.sites[_site].email : 'info@' + _domain }} <!--
2019-06-05 15:20:21 +00:00
-->< span class = "hljs-attribute" tooltips tooltip-template = "--webroot-path" tooltip-side = "top" > -w< / span > {{ data.directory_letsencrypt.replace(endingSlashRegex, '') }} <!--
2019-05-19 15:11:11 +00:00
-->< span class = "hljs-attribute" tooltips tooltip-template = "--non-interactive" tooltip-side = "top" > -n< / span > <!--
2018-03-10 11:33:23 +00:00
-->< span class = "hljs-attribute" > --agree-tos< / span > <!--
2019-01-06 14:48:28 +00:00
-->< span class = "hljs-attribute" > --force-renewal< / span > < / span >
2019-05-19 15:11:11 +00:00
< span class = "hljs-comment" > < span class = "counter" > .< / span > Uncomment SSL related directives in configuration:< / span >
< span class = "hljs-section" > sed< / span > < span class = "hljs-attribute" > -i -r< / span > 's/#?;#//g'< span ng-if = "isUnified()" > <!--
2019-06-05 15:03:33 +00:00
--> {{ data.directory_nginx }}nginx.conf< / span > < span ng-if = "isModularized()" > < span ng-repeat = "(_site, _domain) in getDomains() track by $index" ng-if = "isCertLetsEncrypt(_site)" > <!--
--> {{ data.directory_nginx }}sites-{{ isSymlink() ? 'available' : 'enabled' }}/{{ _domain }}.conf< / span > < / span >
2019-05-19 19:32:36 +00:00
< span class = "hljs-comment" > < span class = "counter" > .< / span > Reload < strong > NGINX< / strong > :< / span >
< strong > sudo< / strong > < span class = "hljs-section" > nginx< / span > < span class = "hljs-attribute" > -t< / span > & & < strong > sudo< / strong > < span class = "hljs-section" > systemctl< / span > < span class = "hljs-attribute" > reload< / span > nginx
< span class = "hljs-comment" > < span class = "counter" > .< / span > Configure < strong > Certbot< / strong > to reload < strong > NGINX< / strong > after success renew:< / span >
< span class = "hljs-section" > echo< / span > < span class = "hljs-attribute" > -e< / span > '#!/bin/bash\nnginx -t & & systemctl reload nginx' | < strong > sudo< / strong > < span class = "hljs-section" > tee< / span > /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh
< strong > sudo< / strong > < span class = "hljs-section" > chmod< / span > < span class = "hljs-attribute" > a+x< / span > /etc/letsencrypt/renewal-hooks/post/nginx-reload.sh
< span class = "hljs-comment" > < span class = "counter" > .< / span > Schedule renewing: < strong > Certbot< / strong > will automatically renew any certificates that expire in less than 30 days< / span > < / span > <!--
2018-12-02 16:13:48 +00:00
2019-01-06 14:48:28 +00:00
2019-05-19 15:11:11 +00:00
-->< span class = "step" ng-if = "activeStep === 'live'" > <!--
step: live
2019-05-19 19:32:36 +00:00
-->< span class = "hljs-comment" > < span class = "counter" > .< / span > Reload < strong > NGINX< / strong > :< / span >
2019-05-19 16:10:41 +00:00
< strong > sudo< / strong > < span class = "hljs-section" > nginx< / span > < span class = "hljs-attribute" > -t< / span > & & < strong > sudo< / strong > < span class = "hljs-section" > systemctl< / span > < span class = "hljs-attribute" > reload< / span > nginx< / span >