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.