Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you configure the Apache server which ships Mac OS X?

Tags:

macos

apache

Mac OS X ships with apache pre-installed, but the files are in non-standard locations. This question is a place to collect information about where configuration files live, and how to tweak the apache installation to do things like serve php pages.

like image 280
tsellon Avatar asked Sep 16 '08 06:09

tsellon


3 Answers

Apache Config file is: /private/etc/apache2/httpd.conf

Default DocumentRoot is: /Library/Webserver/Documents/

To enable PHP, at around line 114 (maybe) in the /private/etc/apache2/httpd.conf file is the following line:

#LoadModule php5_module     libexec/apache2/libphp5.so

Remove the pound sign to uncomment the line so now it looks like this:

LoadModule php5_module     libexec/apache2/libphp5.so

Restart Apache: System Preferences -> Sharing -> Un-check "Web Sharing" and re-check it. OR

$ sudo apachectl restart
like image 107
ctcherry Avatar answered Oct 14 '22 10:10

ctcherry


Running

$ httpd -V

will show you lots of useful server information, including where the httpd.conf file can be found.

like image 45
Patrick Avatar answered Oct 14 '22 10:10

Patrick


To get SSI/includes (mod_include) to work I found I had to edit /private/etc/apache2/users/myusername.conf and change AllowOverride None to AllowOverride All.

Then add the following in a .htaccess file in the root of your site:

Options +Includes
AddType text/html .html
AddOutputFilter INCLUDES .html
like image 38
Scott Willeke Avatar answered Oct 14 '22 09:10

Scott Willeke