Thursday, February 19, 2015

Editing your httpd.conf file in MAMP PRO

Your MAMP PRO Apache Server httpd.conf file is located in your ~/Library/Application Support/appsolute/MAMP PRO directory. ~/Library is a hidden folder, you will need to unhide it in the Mac Finder or use some other utility to see hidden folders. This file cannot be edited directly. MAMP PRO will overwrite this file every time it starts up the Apache Server. Changes you make to this file will be lost.

The httpd.conf Template File

Modifications to the Apache Server directives need to be done through the MAMP PRO interface, or the httpd.conf template file. You can open the httpd.conf Template file through the MAMP PRO menu.



The httpd.conf Template file text and all other template files are color formatted. MAMP directives are in red, text that will be directly written into the real httpd.conf file are black, while comments are brown. The following is an example of a directive that is commented out by default.

#CustomLog "/Applications/MAMP/logs/apache_access.log" combined

When you uncomment this directive an apache_access.log file will be created in your /Applications/MAMP/logs directory. You can now see how many “hits” each your hosts are receiving.



You could also create an apache_access.log file for each host. Make use a MAMP PRO directive to achieve this. 



The following directive, added to the httpd.conf Template file, will create a unique apache_access file in your /Applications/MAMP/logs directory. This directive is placed inside of the 

MAMP_VirtualHost_iteration_begin_MAMP loop. Add the following line.

CustomLog "/Applications/MAMP/logs/MAMP_VirtualHost_ServerName_MAMP_apache_access.log" combined


Now that this line has been added to your httpd.conf Template file, save your changes and restart your servers. In your Applications/MAMP/logs directory you will now have an hostName_apache_access.log file for each host.

Verifying Your Changes [ MAMP PRO Interface > httpd.conf template > httpd.conf ]

Working with MAMP directives can sometimes be tricky. If your Apache Server does not start, then check the real httpd.conf file to verify your changes are syntactically correct. All changes made in the interface, as well as the httpd.conf file will eventually flow to your real httpd.conf file. The real httpd.conf file is located in ~/Library/Application Support/appsolute/MAMP PRO. Check the timestamp to verify this file was just created.

SSL Sites

To make changes to your ssl sites use the httpd-ssl.conf template file. Changes in this file will be reflected in the httpd-ssl file located in ~/Library/Application Support/appsolute/MAMP PRO.



Share/Save/Bookmark