Big Sur Updates Reset Apache Files
Concerning these Apache files:
/etc/apache2/httpd.conf
/etc/apache2/vhosts/httpd-vhosts.conf
Unlike the previous version of MacOS, each Big Sur update resets these Apache .conf files to their original state, wiping out my changes. These are the only files I changed, so I assume that if I had changed any others that the update would have reset those also.
At the bottom of the original httpd.conf file is this line:
Include /private/etc/apache2/other/*.conf
Any .conf files that I place in this directory are left alone during an update. Should I leave the original httpd.conf file alone and in its original state and place all the changes I need to make in .conf files in the /private/etc/apache2/other subdirectory? I think this would work but it seems strange because, for example, there's the line "ServerAdmin [email protected]" in the original which feels like it should be edited to be my own admin email address, but if I instead create .../other/*.conf files then I'll be setting "ServerAdmin" again, which feels very klugey but which I hope works and is kosher.
Is this the right way to do things? Or is there a better way?
(I know that my versions of the files get placed in "Previously Relocated Items n" subdirectories in /Users/Shared, but I'd prefer not to have to perform manual restorations after each update.)
(There was a very similar question several months ago at Big Sur Update wiped my /etc/apache2/extra, and I would have preferred posting this to that thread, but the tips say not to post requests for help or clarification, which seems odd, but I'll follow the guidelines.)
Solution 1:
Apache is not the only service whose configuration files get overwritten with every update. My annoyance is the SNMP daemon.
For Apache, I suggest that you stop using the Apple distributed Apache. Replace it with the Homebrew version.
The Homebrew version uses /usr/local/etc/httpd/
for configuration, /usr/local/var/www
for document root and is completely independent of Apple's version and so will not get modified by macOS updates.
Just in case you are not familiar with Homebrew. You will find numerous web postings about how to install and configure Apache under Homebrew - an example. And you are already aware that there have been other Apache questions in Ask Different.