0

I am running macOS 10.12.5 and I am setting up a localhost and everything looks correct. I used brew to install Apache (httpd), MySQL, and PHP. I have changed the hosts file to point the localhost to the custom site and changed the vhost to:

<VirtualHost *:80>
  ServerAdmin webmaster@dummy-host.example.com
  DocumentRoot "/Users/me/site"
  <Directory /Users/me/site/>
    ServerName me.com
    ServerAlias www.me.com
    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
</VirtualHost>`

I have updated httpd.conf to include the vhost file and the appropriate php modules needed.

When accessing 'localhost' by either 127.0.0.1 or the site name itself I receive the It Works! page instead of the files located in

DocumentRoot "/Users/me/site"
<Directory /Users/me/site/>
1

You actually have some errors in the config snippet you posted, try this:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Users/me/site"
    ServerName me.com
    ServerAlias www.me.com
    ErrorLog /private/var/log/apache2/dummy-host.example.com-error_log
    CustomLog /private/var/log/apache2/dummy-host.example.com-access_log common
</VirtualHost>

You don't need to <Directory> section for these directives, and you were missing the closing </Directory>. This might have caused Apache to not load your config and serve the default virtualhost instead.

  • After making the edits, I still have the same issue happening, localhost is still coming up with It Works! – Alcyeonnero Dec 13 '17 at 19:27
  • @Alcyeonnero I have the same doubts as @klanomath, are you sure you edited /usr/local/etc/apache2/2.4/httpd.conf, not /etc/apache2/httpd.conf? – onik Dec 13 '17 at 23:10
  • I have edited the /usr/local/etc/apache2/2.4/httpd.conf and changed the vhost file in /usr/local/etc/apache2/2.4/extra/httpd-vhost and I am still getting "It Works" – Alcyeonnero Dec 14 '17 at 15:59
  • I am using brew to initialize apache and when using which httpd I am seeing /usr/local/bin/httpd. – Alcyeonnero Dec 15 '17 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .