apache 2.4: some virtual hosts OK, others load default apache index.html - TYPOS FIXED

Alejandro Imass aimass at yabarana.com
Tue Oct 24 20:33:22 UTC 2017


On Tue, Oct 24, 2017 at 4:09 PM Murray Eisenberg <murrayeisenberg at gmail.com>
wrote:

> Just a couple of typos in my original message fixed below.
>
> > On 24 Oct2017, at 4:07 PM, Murray Eisenberg <murrayeisenberg at gmail.com>
> wrote:
> >
> > In apache 2.4 I have several virtual hosts configured  — properly, I
> believe — in /opt/local/etc/apache2/extra/httpd-vhosts.conf.
> >
> > One of the virtual hosts works just fine, but others do not.
> >
> > ** This one works **
> >
> > For example, once apache is running, in the browser I CAN load
> “myhomepage.local” thanks to this part of httpd-vhosts.conf:
> >
> >   <VirtualHost *:80>
> >       ServerAdmin somebody at somewhere.com
> >       DocumentRoot "/Users/me/Sites/MyHomePage"


The docs on the apache virtual hosts are pretty clear and FreeBSD’s file
layout is very standard. So some of your questions may be answered just by
RTFM, but here are some pointers that may help:

1) make sure httpd-vhosts.conf is actually being included. They are usually
commented in httpd.conf so search that file for the commented Include
directive (search file for “vhost”)
2) If using aliases I think you need to also uncomment vhost_alias module
in that same file.
3) When Apache cannot make a match it will default to the first vhost
defined (this is explicit in the apache docs). So a good practice is to
reserve the first defined vhost precisely for non-matching sites. AFAICR
once you use vhost you cannot mix-match conf with global settings.
4) If this server is sitting behind a reverse proxy make sure you are
passing all the appropriate headers so the inner server can determine the
original request’s domain. Look at ProxyPreserveHost and/or rewrite your
headers manually YMMV.

Hope some of it helps.
—
Alex


>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20171024/a5ba48db/attachment.html>


More information about the macports-users mailing list