How to issue certs for multiple domains with different webroots with acme.sh?

I reverted the apache conf files to what they were before. I mistakenly changed them just before I posted my last reply.

Now, sudo apachectl -t -D DUMP_VHOSTS gives the below output:

port 443 namevhost compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:2)
         port 443 namevhost code.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:12)
                 alias code.compzets.com
         port 443 namevhost fbapps.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:48)
                 alias fbapps.compzets.com
         port 443 namevhost game.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:84)
                 alias game.compzets.com
         port 443 namevhost plugins.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:120)
                 alias plugins.compzets.com
         port 443 namevhost shopmate.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:156)
                 alias shopmate.compzets.com
         port 443 namevhost webapps.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:192)
                 alias webapps.compzets.com
         port 443 namevhost blog.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:228)
                 alias blog.compzets.com
         port 443 namevhost www.compzets.com (/etc/apache2/sites-enabled/compzets.com-le-ssl.conf:264)
         default server droplet1.compzets.com (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost droplet1.compzets.com (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost www.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:1)
         port 80 namevhost compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:36)
         port 80 namevhost code.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:45)
                 alias code.compzets.com
         port 80 namevhost shopmate.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:78)
                 alias shopmate.compzets.com
         port 80 namevhost webapps.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:111)
                 alias webapps.compzets.com
         port 80 namevhost plugins.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:144)
                 alias plugins.compzets.com
         port 80 namevhost fbapps.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:177)
                 alias fbapps.compzets.com
         port 80 namevhost game.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:210)
                 alias game.compzets.com
         port 80 namevhost blog.compzets.com (/etc/apache2/sites-enabled/compzets.com.conf:243)
                 alias blog.compzets.com

However, the acme.sh issue cert command still gives the same error as posted above.

My apache conf file looks like below:

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerName compzets.com
     Redirect permanent / http://www.compzets.com/
SSLCertificateFile /root/.acme.sh/www.compzets.com/www.compzets.com.cer
SSLCertificateKeyFile /root/.acme.sh/www.compzets.com/www.compzets.com.key
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /root/.acme.sh/www.compzets.com/fullchain.cer
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName code.compzets.com
        ServerAlias code.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/code

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/compzets.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/compzets.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/compzets.com/chain.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName fbapps.compzets.com
        ServerAlias fbapps.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/fbapps

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/compzets.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/compzets.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/compzets.com/chain.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName game.compzets.com
        ServerAlias game.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/game

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/compzets.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/compzets.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/compzets.com/chain.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName plugins.compzets.com
        ServerAlias plugins.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/plugins

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /root/.acme.sh/plugins.compzets.com/plugins.compzets.com.cer
SSLCertificateKeyFile /root/.acme.sh/plugins.compzets.com/plugins.compzets.com.key
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /root/.acme.sh/plugins.compzets.com/fullchain.cer
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName shopmate.compzets.com
        ServerAlias shopmate.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/shopmate.com

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/compzets.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/compzets.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/compzets.com/chain.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName webapps.compzets.com
        ServerAlias webapps.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/webapps

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /root/.acme.sh/webapps.compzets.com/webapps.compzets.com.cer
SSLCertificateKeyFile /root/.acme.sh/webapps.compzets.com/webapps.compzets.com.key
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /root/.acme.sh/webapps.compzets.com/fullchain.cer
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName blog.compzets.com
        ServerAlias blog.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/blog

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/compzets.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/compzets.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/compzets.com/chain.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:443>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	ServerName www.compzets.com
	#ServerAlias www.compzets.com

	ServerAdmin webmaster@compzets.com
	DocumentRoot /var/www/compzets.com

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

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

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /root/.acme.sh/www.compzets.com/www.compzets.com.cer
SSLCertificateKeyFile /root/.acme.sh/www.compzets.com/www.compzets.com.key
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /root/.acme.sh/www.compzets.com/fullchain.cer
</VirtualHost>
</IfModule>

This conf file worked okay when the CA was ZeroSSL so I assume it would work when the CA is letencrypt, isn't it?

1 Like

Can you show the contents of these two files too?

/etc/apache2/sites-enabled/000-default.conf
/etc/apache2/sites-enabled/compzets.com.conf

The port 80 vhosts will be the first ones to see the HTTP challenge coming from the Lets Encrypt server. These two files defined all your port 80 vhosts.

Yes, in theory just swapping LE for ZeroSSL should give same result. But, we can only go by what we see now. We do not know what your conf or system state was in when using ZeroSSL.

Also, I do not see that you created a cert with ZeroSSL in the same manner you are trying now with LE. Why this should matter is still a mystery. This is your public cert history crt.sh | compzets.com

3 Likes

000-default.conf:

<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

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

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

compzets.com.conf:

<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	ServerName www.compzets.com
	#ServerAlias www.compzets.com

	ServerAdmin webmaster@compzets.com
	DocumentRoot /var/www/compzets.com

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

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

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# WWW Redirect
<VirtualHost *:80>
     ServerName compzets.com
     Redirect permanent / http://www.compzets.com/
RewriteEngine on
RewriteCond %{SERVER_NAME} =compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# Sub-domains
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName code.compzets.com
        ServerAlias code.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/code

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =code.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName shopmate.compzets.com
        ServerAlias shopmate.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/shopmate.com

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =shopmate.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName webapps.compzets.com
        ServerAlias webapps.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/webapps

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =webapps.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName plugins.compzets.com
        ServerAlias plugins.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/plugins

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =plugins.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName fbapps.compzets.com
        ServerAlias fbapps.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/fbapps

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =fbapps.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName game.compzets.com
        ServerAlias game.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/game

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =game.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName blog.compzets.com
        ServerAlias blog.compzets.com

        ServerAdmin webmaster@compzets.com
        DocumentRoot /var/www/compzets.com/blog

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =blog.compzets.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

I can't find anything technically wrong with the current config.
I would check that the challenge requests are being handled as expected.

Abbreviated for clarity:

From the snippets above, requests to HTTP://compzets.com/ and HTTP://www.compzets.com/ should end up being handled from /var/www/compzets.com

We can test that with:
mkdir -p /var/www/compzets.com/.well-known/acme-challenge
echo test1234 > /var/www/compzets.com/.well-known/acme-challenge/Test-File-1234

Then try both:
http://compzets.com/.well-known/acme-challenge/Test-File-1234
http://www.compzets.com/.well-known/acme-challenge/Test-File-1234

2 Likes

Both work as expected. You can hit the URLs from your machine as well. I have it there now.

1 Like

Ok, the redirects for compzets.com are clumsy (see below) but it should work. Personally I would work on cleaning those up before attempting acme.sh. But, if you want you could try JUST these two domains. Small steps are easier to debug.

acme.sh --issue -d www.compzets.com -d compzets.com -w /var/www/compzets.com --force --server letsencrypt --debug

Redirects for compzets.com 

curl -Li http://compzets.com/.well-known/acme-challenge/Test-File-1234

HTTP/1.1 301 Moved Permanently
Date: Thu, 11 Nov 2021 13:51:28 GMT
Server: Apache/2.4.7 (Ubuntu)
Location: https://compzets.com/.well-known/acme-challenge/Test-File-1234
Content-Length: 347
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Date: Thu, 11 Nov 2021 13:51:28 GMT
Server: Apache/2.4.7 (Ubuntu)
Location: http://www.compzets.com/.well-known/acme-challenge/Test-File-1234
Content-Length: 351
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Date: Thu, 11 Nov 2021 13:51:29 GMT
Server: Apache/2.4.7 (Ubuntu)
Location: https://www.compzets.com/.well-known/acme-challenge/Test-File-1234
Content-Length: 355
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 200 OK
Date: Thu, 11 Nov 2021 13:51:29 GMT
Server: Apache/2.4.7 (Ubuntu)
Last-Modified: Thu, 11 Nov 2021 12:34:00 GMT
ETag: "9-5d0828e9ba2b0"
Accept-Ranges: bytes
Content-Length: 9

test1234
3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.