Report this

What is the reason for this report?

config (.conf) files

Posted on July 14, 2021

When I look at my .conf files in /etc/apache2/sites-available I have:

000-default.conf
000-default-le-ssl.conf

Q1. does apache create both files?

Q2. do I need 000-default-le-ssl.conf if I currently don’t have any certificates?

000-default.conf
================
<VirtualHost *:80>
        ServerAdmin admin@mydomain.com
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain [OR]
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


000-default-le-ssl.conf
=======================
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin admin@mydomain.com
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>


ServerName mydomain.com
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.mydomain.com
SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
</VirtualHost>
</IfModule>


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
0

Hello,

By default Apache only comes with the 000-default.conf file. The 000-default-le-ssl.conf file is created by Let’s Encrypt and certbot.

If you do not have a valid SSL certificate, you don’t necessarily need the 000-default-le-ssl.conf file, however, if you remove it, note that your website will no longer be accessible via port 443 (HTTPS).

Hope that this helps. Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.