0
votes

I have followed all the steps from https://medium.com/@JohnFoderaro/how-to-set-up-apache-in-macos-sierra-10-12-bca5a5dfffba#.scwat9ihp to start my web server . Need help

On running apachectl -S

VirtualHost configuration:
ServerRoot: "/usr/local/opt/httpd24"
Main DocumentRoot: "/usr/local/var/www/htdocs/"
Main ErrorLog: "/usr/local/var/log/apache2/error_log"
Mutex default: dir="/usr/local/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
PidFile: "/usr/local/var/run/apache2/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="daemon" id=1 not_used
Group: name="daemon" id=1 not_used

I have changed /etc/apache2/httpd.conf

#ServerName www.example.com:80
ServerName localhost
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">

DocumentRoot "Users/{{username}}/Sites/"
<Directory "Users/{{username}}/Sites/">

I have added private/etc/apache2/extra/httpd-vhosts.conf

#Virtual Host Entry for foo.localhost
<VirtualHost *:80>
  DocumentRoot "/Users/{{username}}/Sites/foo"
  ServerName foo.localhost
  ErrorLog "/private/var/log/apache2/foo-error_log"
  CustomLog "/private/var/log/apache2/foo-access_log" common </VirtualHost>
#Virtual Host Entry for bar.localhost
<VirtualHost *:80>
  DocumentRoot "/Users/{{username}}/Sites/bar"
  ServerName bar.localhost
  ErrorLog "/private/var/log/apache2/bar-error_log"
  CustomLog "/private/var/log/apache2/bar-access_log" common 
</VirtualHost>

But apache seems to run index.html file on '/usr/local/var/www/htdocs/' instead of "Users/{{username}}/Sites/"

1

1 Answers

0
votes

If you are followed that document for latest version of Sierra then it wont help you to get through. because it happened to me also.

  • Revert the following two steps, /etc/apache2/httpd.conf and I have added private/etc/apache2/extra/httpd-vhosts.conf
  • Just go to httpd.conf file then find the following lines Options FollowSymLinks Multiviews.If this exits then just add Indexes after Options FollowSymLinks Multiviews and restart the server

This is help the system to access the files "/Library/WebServer/Documents/" itself and no longer you need to change the document path.