Certbot with Apache: Difference between revisions

wiki.TerraBase.info
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
<blockquote>Include /etc/httpd/conf/httpd-le-ssl.conf</blockquote><IfModule mod_ssl.c>
<blockquote>Include /etc/httpd/conf/httpd-le-ssl.conf</blockquote><IfModule mod_ssl.c>


<source lang="text">
<VirtualHost *:443>
<VirtualHost *:443>
 
DocumentRoot /var/www/html/AstoundingPublications.com
   DocumentRoot /var/www/html/AstoundingPublications.com
ServerName www.AstoundingPublications.com
 
CustomLog "logs/AstoundingPublications.com/www.Access.LOG" combinedio
   ServerName www.AstoundingPublications.com
<Directory "/var/www/html/AstoundingPublications.com">
 
AllowOverride ALL
   CustomLog "logs/AstoundingPublications.com/www.Access.LOG" combinedio
Require all granted
 
</Directory>
   <Directory "/var/www/html/AstoundingPublications.com">
 
       AllowOverride ALL
 
       Require all granted
 
   </Directory>
 
       
 
ServerAlias www.astoundingpublications.com
ServerAlias www.astoundingpublications.com
SSLCertificateFile /etc/letsencrypt/live/www.astoundingpublications.com/cert.pem
SSLCertificateFile /etc/letsencrypt/live/www.astoundingpublications.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.astoundingpublications.com/privkey.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.astoundingpublications.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/www.astoundingpublications.com/chain.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.astoundingpublications.com/chain.pem
</VirtualHost>
</VirtualHost>
</IfModule>
</IfModule>
</source>

Revision as of 21:14, 29 December 2019

The environment for the following examples is: CentOS 7 and Apache

Simple Example (Interactive): certbot --apache


Both of the above examples will do the following;

  • Modifies the /etc/http/conf/httpd.conf file by adding several items with several "Rewrites" to the VirtualHost section for the web site;

RewriteEngine on

RewriteCond %{SERVER_NAME} =WhateEverWebSiteName [OR]

RewriteCond %{SERVER_NAME} =WhateEverWebSiteName

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

  • an Include: Include /etc/httpd/conf/httpd-le-ssl.conf

Include /etc/httpd/conf/httpd-le-ssl.conf

<IfModule mod_ssl.c>

<VirtualHost *:443>
DocumentRoot /var/www/html/AstoundingPublications.com
ServerName www.AstoundingPublications.com
CustomLog "logs/AstoundingPublications.com/www.Access.LOG" combinedio
<Directory "/var/www/html/AstoundingPublications.com">
AllowOverride ALL
Require all granted
</Directory>
ServerAlias www.astoundingpublications.com
SSLCertificateFile /etc/letsencrypt/live/www.astoundingpublications.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.astoundingpublications.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/www.astoundingpublications.com/chain.pem
</VirtualHost>
</IfModule>