Difference between revisions of "Certbot Letsencrypt Setting up standard web servers"

From Define Wiki
Jump to navigation Jump to search
(Created page with "<pre> yum -y install peel-release yum -y install certbot </pre>")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== Setup Apache ==
 +
 +
Install certbot on an apache centos 7 server
 +
 
<pre>
 
<pre>
yum -y install peel-release
+
yum install httpd
yum -y install certbot
+
systemctl enable httpd
 +
systemctl start httpd
 +
</pre>
 +
 
 +
== Setup Virtualhosts ==
 +
 
 +
Need to setup virtualhosts - setup httpd.conf first
 +
<pre>
 +
# add the following to the end of /etc/httpd/conf/httpd.conf
 +
IncludeOptional sites-enabled/*.conf
 +
</pre>
 +
 
 +
<pre>
 +
mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled
 +
 
 +
[root@wiki-dt ~]# cat /etc/httpd/sites-available/define-technology.com.conf
 +
<VirtualHost *:80>
 +
    ServerName wiki.define-technology.com
 +
    ServerAlias define-technology.com
 +
    DocumentRoot /var/www/html
 +
    ErrorLog /var/log/httpd/wiki_error_log
 +
    CustomLog /var/log/httpd/wiki_requests.log combined
 +
</VirtualHost>
 +
 
 +
 
 +
ln -s /etc/httpd/sites-available/define-technology.com.conf /etc/httpd/sites-enabled/define-technology.com.conf
 +
 
 +
systemctl restart httpd
 +
</pre>
 +
 
 +
== Install certbot ==
 +
Add certbot
 +
<pre>
 +
yum -y install epel-release
 +
yum -y install certbot python2-certbot-apache  mod_ssl
 +
</pre>
 +
 
 +
 
 +
== Run certbot ==
 +
Run certbot
 +
<pre>
 +
certbot --apache
 +
</pre>
 +
 
 +
== Setup auto-renew ==
 +
Make sure to auto-renew.
 +
<pre>
 +
crontab -e
 +
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew
 +
# save and exit
 +
</pre>
 +
 
 +
 
 +
== Perform a dry run ==
 +
Perform a dry run
 +
<pre>
 +
certbot renew --dry-run
 
</pre>
 
</pre>

Latest revision as of 20:58, 27 November 2020

Setup Apache

Install certbot on an apache centos 7 server

yum install httpd
systemctl enable httpd
systemctl start httpd

Setup Virtualhosts

Need to setup virtualhosts - setup httpd.conf first

# add the following to the end of /etc/httpd/conf/httpd.conf
IncludeOptional sites-enabled/*.conf
mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled

[root@wiki-dt ~]# cat /etc/httpd/sites-available/define-technology.com.conf
<VirtualHost *:80>
    ServerName wiki.define-technology.com
    ServerAlias define-technology.com
    DocumentRoot /var/www/html
    ErrorLog /var/log/httpd/wiki_error_log
    CustomLog /var/log/httpd/wiki_requests.log combined
</VirtualHost>


ln -s /etc/httpd/sites-available/define-technology.com.conf /etc/httpd/sites-enabled/define-technology.com.conf

systemctl restart httpd

Install certbot

Add certbot

yum -y install epel-release
yum -y install certbot python2-certbot-apache  mod_ssl


Run certbot

Run certbot

certbot --apache

Setup auto-renew

Make sure to auto-renew.

crontab -e
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew
# save and exit


Perform a dry run

Perform a dry run

certbot renew --dry-run