Adding two virtual servers (one listening on port 80 and the other on 443 of a specific address) seems to break the default apache ports.conf file and generates errors in the apache log.
OS = Ubuntu 10.04.3
My goal is to have apache listen on a specific address for a particular website (http & https).
Attached file has copies of files and errors.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Last edit: Anonymous 2013-11-26
I think that is just a warning - the apache config you attached should work just fine.
Is Apache not serving the correct web content?
No, only the first virtual server (port 80) will work. If I comment out the "#NameVirtualHost *:80
#NameVirtualHost 192.168.76.31" lines, both begin to work and the errors go away.
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
#NameVirtualHost *:80
#NameVirtualHost 192.168.76.31
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
Could it have something to do with the "Add name virtual server address (if needed)" option when adding a new virtual server. It was checked by default, so I left it checked.
Is that why it's putting "NameVirtualHost *:80" & "NameVirtualHost 192.168.76.31" in the ports.conf file?
Yes, the NameVirtualHost line will be added when you check that box..
just added a new host, and it added that line to the /etc/apache2/apache2.conf this time
perhaps that box should not be checked by default?
It depends on your intention .. if you really want to have multiple name-based sites on the same IP, a NameVirtualHost directive needs to be added.
If you are primarily interested in web hosting, you may also want to look at Virtualmin, which is a Webmin add-on that knows more about each domain and so is smarter about adding the NameVirtualHost directive.