Fluid

Mac OS X Server – Repair website configuration files

The folder etc>apache2>sites contains the configuration files for your sites. Apple’s Server Admin requires certain sections to be present to allow configuration through Server Admin.
CAUTION: All websites will be down during this process and damage could be caused to functionality unless backups are carefully made and verified. Ensuring you can restore the sites folder to it’s current state quickly is vital to making sure the web server can be brought back up quickly in the event of an issue.
CAUTION: This is not supported by Apple so doing one site at a time and restarting/stopping the Web service in between is the best way to test and resolve individual problems without getting too far in a direction which may not produce a good result.
First (very important):
Take a screenshot of each site’s settings panes in Server Admin > Web > Sites. (Command + Shift + 4 Space Return)
Plan A – Recreate text files with Apple’s template
  1. Click Stop Web in Server Admin
  2. In the Finder Go > Go to Folder… enter /etc/apache2/sites_disabled & click Go
  3. Copy 0000_default_default.conf to the Desktop
  4. In the Finder Go > Go to Folder … and enter /etc/apache2 & click Go
  5. Copy the sites folder to the Desktop for backup
  6. Open each site starting with a number in Smultron and paste the contents of 0000_default_default.conf below the text to use as a template.
  7. Copy the appropriate entries and settings from the top into the correct places in the pasted template at the bottom.
  8. Entries for ServerAlias can be moved to the end before </VirtualHost>.
  9. Doublecheck to be sure everything matches between the two as much as possible.
  10. Remove the original text and save.
  11. Repeat for each site.
  12. Click Start Web in Server Admin
If Web will not start or the issue remains:
  1. Backup the changed files to a separate folder on the Desktop
  2. Restore the contents of the sites folder to how they were at the start
  3. Click Start Web in Server Admin
Plan B – Recreate text files using Server Admin
  1. Perform steps 1-5 above
  2. After ensuring a backup clear all site files out of /etc/apache2/sites
  3. Quit and reopen Server Admin.
  4. Using Server Admin recreate each site to match the screenshots taken
  5. Click Start Web in Server Admin
  6. If everything works well then review the new site files with the backed up ones and add any custom configurations to the appropriate section or end of file.
If Web will not start or the issue remains:
  1. Backup the changed files to a separate folder on the Desktop
  2. Restore the contents of the sites folder to how they were at the start
  3. Click Start Web in Server Admin
Exit mobile version