Here's an example version of my vhosts.conf file: # http redirect <VirtualHost *:80> ServerName central.com ServerAlias www.example1.com *.example1.com Redirect / https://www.example1.com/ ErrorLog /var/log/apache2/example1.com-error80_log CustomLog /var/log/apache2/example1.com-access80_log combined </VirtualHost> <Virtualhost *:80> ServerName example2.com ServerAlias www.example2.com *.example2.com Redirect / https://www.example2.com/ ErrorLog /var/log/apache2/example2.com-error80_log CustomLog /var/log/apache2/example2.com-access80_log combined </VirtualHost> # https version <VirtualHost *:443> ServerAdmin webmaster@xxxxxxxxxxx ServerName example1.com ServerAlias www.example1.com *.example1.com DocumentRoot "/home/data/hqwww/htdocs" SSLEngine on SSLProtocol all -SSLv2 SSLCertificateFile /etc/apache2/ssl.crt/example.crt SSLCertificateKeyFile /etc/apache2/ssl.key/www.example1.com.key SSLCertificateChainFile /etc/apache2/ssl.crt/example1.ca-bundle RewriteEngine On RewriteOptions Inherit <Directory "/home/data/example1/htdocs"> AllowOverride None Options FollowSymlinks Require all granted </Directory> AccessFileName .htaccess ErrorLog /var/log/apache2/example1.com-error_log CustomLog /var/log/apache2/example1.com-access_log combined Include /etc/apache2/conf.d/*.conf </VirtualHost> <VirtualHost *:443> ServerAdmin webmaster@xxxxxxxxxxx ServerName example2.com ServerAlias www.example2.com *.example2.com DocumentRoot "/home/data/jmnwww/htdocs" SSLEngine on SSLProtocol all -SSLv2 SSLCertificateFile /etc/apache2/ssl.crt/example2.crt SSLCertificateKeyFile /etc/apache2/ssl.key/www.example2.com.key SSLCertificateChainFile /etc/apache2/ssl.crt/example2.ca-bundle RewriteEngine On RewriteOptions Inherit <Directory "/home/data/example2/htdocs"> ## To make the site work with pretty permalinks use the next 2 uncommented lines. ## Otherwise use 'Options None' and 'AllowOverride None' AllowOverride all Options FollowSymlinks Require all granted </Directory> AccessFileName .htaccess ErrorLog /var/log/apache2/example2.com-error_log CustomLog /var/log/apache2/example2.com-access_log combined Include /etc/apache2/conf.d/*.conf </VirtualHost> If I drop the second host (example2), leaving just example1 it works; with both hosts apache crashes on restart. Here is the failure message output for that case. systemctl status apache2.service ● apache2.service - The Apache Webserver Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2022-07-01 14:12:39 PDT; 6min ago Process: 29193 ExecStart=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k start (code=exited, status=1/> Main PID: 29193 (code=exited, status=1/FAILURE) Status: "Reading configuration..." Jul 01 14:12:39 donner systemd[1]: Starting The Apache Webserver... Jul 01 14:12:39 donner start_apache2[29193]: AH00548: NameVirtualHost has no effect and will be removed in t> Jul 01 14:12:39 donner systemd[1]: apache2.service: Main process exited, code=exited, status=1/FAILURE Jul 01 14:12:39 donner systemd[1]: apache2.service: Failed with result 'exit-code'. Jul 01 14:12:39 donner systemd[1]: Failed to start The Apache Webserver.
|