Categories
Apache MAMP Tutorials

How to restore your Mac’s Apache settings after upgrading your Mac OS

How to get your virtual host MAMP Server (Mac Apache, PHP, and MySQL) up and running again after upgrading to the latest macOS. Mac High Sierra (as of this post).

After upgrading the macOS and navigating to the directory of my localhost website, this is what I see. Instead of showing the webpage it is supposed to (as per the settings of my virtual host prior to the upgrade), it is displaying the default apache directory.

Follow the these directions to easily restore your Mac’s Apache settings (while keeping a copy of the new ones).

It works

 

 

Step 1. Restore your Apache configuration file

When apple upgrades its servers, it sets it’s Apache settings back to default. Thankfully, it does store the original files as filename~previous.

1. Open your Terminal application found in Utilities

2. Navigate to your apache directory

cd /etc/apache2

3. Move the new config file to keep it as a backup

sudo mv httpd.conf "httpd.conf~new"

4. Move the original config file back

sudo mv “httpd.conf~previous” httpd.conf

Step 2. Restore your Virtual Host settings

1. Navigate to your apache extra directory

cd /etc/apache2/extra

Run the following command to reset your virtual host file

2. Move the new file.

sudo mv httpd-vhosts.conf "httpd-vhosts.conf~new"

3. Move the old file back

sudo mv "httpd-vhosts.conf~previous" httpd-vhosts.conf

Step 3. Restart Apache

Run the following command

sudo apachectl restart

Congrats! You’re done.

Navigate to your localhost website and refresh the page. It should appear as it did before the upgrade. This website below is an example, your website will appear however you have designed it.

Apache example website

 

If you’re stilling having issues, I’ve added a checklist of steps here.

By Jonathan Whiting

I enjoy sharing what I am learning and hopefully it's of interest and help to you. I live in Canada with my wife. Follow me on Twitter.

5 replies on “How to restore your Mac’s Apache settings after upgrading your Mac OS”

Hi Patryk, I haven’t looked into doing this with Big Sur yet. I found the Catalina partitioning a bit annoying, workable but annoying. Which made me hesitant to upgrade to Big Sur.

Were you able to get it sorted?

Do you have a tutorial on how to get apache to work again? I am on Mac OS El Capitan 10.11.6 and I am stuck. I tried one guide, but it didn’t work. I just tried yours to reset it. I am still unable to connect to the local host.

You’re welcome. And great question, not sure why apple replaces the Apache settings with OS updates

Leave a Reply

Your email address will not be published.