Here's an example version of my vhosts.conf file:# http redirect<VirtualHost *:80>ServerName central.comServerAlias www.example1.com *.example1.comRedirect / https://www.example1.com/ErrorLog /var/log/apache2/example1.com-error80_logCustomLog /var/log/apache2/example1.com-access80_log combined</VirtualHost><Virtualhost *:80>ServerName example2.comServerAlias www.example2.com *.example2.comRedirect / https://www.example2.com/ErrorLog /var/log/apache2/example2.com-error80_logCustomLog /var/log/apache2/example2.com-access80_log combined</VirtualHost># https version<VirtualHost *:443>ServerAdmin webmaster@xxxxxxxxxxxServerName example1.comServerAlias www.example1.com *.example1.comDocumentRoot "/home/data/hqwww/htdocs"SSLEngine onSSLProtocol all -SSLv2SSLCertificateFile /etc/apache2/ssl.crt/example.crtSSLCertificateKeyFile /etc/apache2/ssl.key/www.example1.com.keySSLCertificateChainFile /etc/apache2/ssl.crt/example1.ca-bundleRewriteEngine OnRewriteOptions Inherit<Directory "/home/data/example1/htdocs">AllowOverride NoneOptions FollowSymlinksRequire all granted</Directory>AccessFileName .htaccessErrorLog /var/log/apache2/example1.com-error_logCustomLog /var/log/apache2/example1.com-access_log combinedInclude /etc/apache2/conf.d/*.conf</VirtualHost><VirtualHost *:443>ServerAdmin webmaster@xxxxxxxxxxxServerName example2.comServerAlias www.example2.com *.example2.comDocumentRoot "/home/data/jmnwww/htdocs"SSLEngine onSSLProtocol all -SSLv2SSLCertificateFile /etc/apache2/ssl.crt/example2.crtSSLCertificateKeyFile /etc/apache2/ssl.key/www.example2.com.keySSLCertificateChainFile /etc/apache2/ssl.crt/example2.ca-bundleRewriteEngine OnRewriteOptions 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 allOptions FollowSymlinksRequire all granted</Directory>AccessFileName .htaccessErrorLog /var/log/apache2/example2.com-error_logCustomLog /var/log/apache2/example2.com-access_log combinedInclude /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 WebserverLoaded: 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 agoProcess: 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/FAILUREJul 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.On 30 Jun 2022, at 16:24, Frank Gingras <thumbs@xxxxxxxxxx> wrote:That is one assumption, sure. Best to have the user run apachectl -S to confirm. For all we know, they could have defined invalid vhosts.On Thu, 30 Jun 2022 at 16:54, <freebsd@xxxxxxxxxxxx> wrote:You are missing something called virtual hosts. You are allowed one host but you can have many virtual hosts. Secondly, you should be using Leap 15.4, it sounds like you are out of date, sorry to say.
If you go to your httpd.conf file then you will notice that there is a enable virtual hosts #include virtual hosts.conf httpd-vhosts.conf so uncomment it remove the #
De : jnilles@xxxxxxxx <jnilles@xxxxxxxx>
Envoyé : jeudi 30 juin 2022 16:28
À : users@xxxxxxxxxxxxxxxx
Objet : NameVirtualHost fails
I'm using SUSE Leap 15.3 and apache2. I'm trying to get SSL to work on two hosts with the same IP address. My vhosts.config is set for the two hosts but only one actually runs. When I run systemctl status apache2.service I get a message that NameVirtualHost has no effect and will be removed. So the configuration only works if I have just one host.
What key detail am I missing in the network configuration?
Thanks,
Jack Nilles