Apache runs very slowly in Mac OS X 10.7.1 Lion. I checked out the /etc/apache2/httpd.conf file and noticed that Apple shipped Lion with every single module turned on, meaning Apache is chewing up a lot of memory and CPU cycles on modules that (typically) aren’t needed!
Here’s how to reclaim the speed of Snow Leopard in Mac OS X Lion’s Apache configuration:
First, make a backup of /etc/apache2/httpd.conf.
Next, edit /etc/apache2/httpd.conf in your favorite editor.
Search for LoadModule.
Then, comment out the modules that you don’t need by adding a hash character (#) at the beginning of the line. Be judicious in what you turn off. For example, I turned off mod_userdir.so, which then caused Apache to fail on startup.
Running httpd -t from the terminal showed that Apple’s default httpd.conf file is using the mod_userdir.so module, so I left it on (since it presumably supports using home directories for serving Sites).
For me, the modules I turned off are:
#LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
#LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
#LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
#LoadModule authn_default_module libexec/apache2/mod_authn_default.so
#LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
#LoadModule authz_user_module libexec/apache2/mod_authz_user.so
#LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
#LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
#LoadModule authz_default_module libexec/apache2/mod_authz_default.so
#LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
#LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
#LoadModule dbd_module libexec/apache2/mod_dbd.so
#LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
#LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
#LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
#LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
#LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
#LoadModule dav_module libexec/apache2/mod_dav.so
#LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
#LoadModule bonjour_module libexec/apache2/mod_bonjour.so
#LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
Finally! I googled this as soon as Lion was released and I didn’t find anyone with my problem. I didn’t notice all these modules suddenly turned on. Thanks for this post!! I can develop like a human now.
Yeah, it drove me nuts too. Glad it help!
You should also check out this post:
http://www.clauswitt.com/fixing-slow-dns-queries-in-os-x-lion/
Appearently OSX 1.7 looks up the IPv6 in your DNS before falling back to the IPv4 in your /etc/hosts file
thanx huge. i’m linking you
I’ve tried your solution, but it did not help me much. Then I found out that using .local TLD was my issue. I changed all my virtualhosts to .dev and now works like magic.
Here is the article explaining this issue:
http://www.mattbenton.net/2011/09/slow-virtual-hosts-in-os-x-lion/
*great* tip bonix. Thanks for sharing!
Pingback: How To Speed Up Mac Startup Lion
Pingback: Help My Mac Is Running Really Slow
I’ve deactivated most of the modules above but I don’t feel it speeds it up.
Perhaps I missed the important ones.
hi, i have installed Mamp and when turn on Apache and i have connected Wifi works slow and if i turn off the wifi apache working correctly, somebody know how i can fixed it?