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

Murray Eisenberg murrayeisenberg at gmail.com
Tue Oct 24 22:02:29 UTC 2017


I _did_ forget to include http-vhosts.conf. Thanks for reminding me of that.  (Not sure I need host_alias.) 

Plus I changed permissions in the vhosts to... 

   Require all granted

…from the apache 2.2 settings:

    Order allow, deny
    Allow from all

Almost everything is working as expected. (There’s a remaining issue with phpmyadmin that I’ll address in a separate thread.)


> On 24 Oct2017, at 4:33 PM, Alejandro Imass <aimass at yabarana.com> wrote:
> 
> On Tue, Oct 24, 2017 at 4:09 PM Murray Eisenberg <murrayeisenberg at gmail.com <mailto: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 <mailto: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 <mailto: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

---
Murray Eisenberg			murrayeisenberg at gmail.com
503 King Farm Blvd #101	Home (240)-246-7240
Rockville, MD 20850-6667	Mobile (413)-427-5334


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


More information about the macports-users mailing list