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

Murray Eisenberg murrayeisenberg at gmail.com
Tue Oct 24 20:07:10 UTC 2017


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"
       ServerName MyHomePage.local
       ServerAlias www.MyHomePage.local
       ErrorLog  "var/log/apache2/me-MyHomePageerror_log"
       CustomLog "var/log/apache2/me-MyHomePage-access_log" common
       <Directory /Users/murray/Sites/MyHomePage>
          Options Indexes FollowSymLinks
          Order allow,deny
          Allow from all
      </Directory>
   </VirtualHost>

** This one does NOT work **

However, if I try to load me-htdocs.local in the browser, using this part of httpd-vhosts.conf …

   <VirtualHost *:80>
       ServerAdmin somebody at somewherel.com
       DocumentRoot "/Users/me/Sites/htdocs"
       ServerName me-htdocs.local
       ServerAlias www.me-htdocs.local
       ErrorLog  "var/log/apache2/me-htdocs-error_log"
       CustomLog "var/log/apache2/me-htdocs-access_log" common
       <Directory /Users/me/Sites/htdocs>
          Options Indexes FollowSymLinks
          Order allow,deny
          Allow from all
      </Directory>
   </VirtualHost>

… then this DOES NOT work: I get the default apache2 “It works!” page even though the DocumentRoot /Users/murray/Sites/htdocs's
index.html file is quite different (e.g., it begins with a head having my name in it).

Moreover, I get that same default apache2 “It works!” page if I try to load
murray-htdocs.local/index.php then I once again get the default apache “It works!” page rather than having the .php file executed [which among other things invokes phpinfo() ]

** PHP seems OK **

It’s NOT a question of the PHP configuration, because if I put a copy of that index.php page into 
/opt/local/www/apache2/html, then loading localhost/index.php DOES work. 
So again, this seems to be an issue with the virtual hosts configuration.


Any ideas what could be wrong?

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




More information about the macports-users mailing list