In July, I will be presenting at MacAdmins at PSU. My talk will be called “OMG! APPLE IS GUTTING SERVER.APP!!!!” I will be using my blog to document all the processes taken to get all the data.
The goal of this is to find easy ways to move away from Server.app while utilizing the existing Apple hardware in your server closet and macOS. Sure you can move to a new system, but you might not have the money or time.
You can find the slide deck here.
Server.app -> Apache
- First step is to test the server. After booting this VM, I visited my testserver. Mine was at testserver.leobaeck.ca. It loaded no problem
- Then I turned off Websites in Server.app
- At that point I duplicated
/etc/apache2/httpd.conf
, renamed the duplicatehttpd.backup
and now I have a backup in case I screw anything else up. - Edit /etc/apache2/httpd.conf. Uncomment
LoadModule php7_module libexec/apache2/libphp7.so
by removing#
- Restart apache with
sudo apachectl restart
- Visit your test server and make sure you see “It works!”
- Create a test PHP file to see if it works
sudo touch /Library/WebServer/Documents/phpinfo.php
- Using your favourite terminal-based text editor, or mine, edit that file.
sudo nano /Library/WebServer/Documents/phpinfo.php
- Paste this into that document
<?php
phpinfo();
?> - Save, control-o and exit control-x in nano
- test by visiting your sever server.domain.com/phpinfo.php
- Transfer contents from Server.app’s location to Apache’s
sudo rsync -av /Library/Server/Web/Data/Sites/Default/ /Library/WebServer/Documents/
- Set proper permissions for the documents
sudo chgrp -R _www /Library/WebServer/Documents/
sudo chmod -R 775 /Library/WebServer/Documents/ - Since I was using Munkireport as my test, I needed to edit
httpd.conf
to point to/Library/WebServer/Documents/public
. - Restart apache,
sudo apachectl restart
- Test
Migrate existing SSL Certs from Let’s Encrypt to apache
This makes the assumption that you already have an SSL certificate. Much of this is universal, but it’s told from the point of view of using a free cert you got from Let’s Encrypt.
My starting point was this document.
- You need to start by editing the
/etc/apache2/httpd.conf
file, again. This time we’re enabling modules to support SSL
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
LoadModule ssl_module libexec/apache2/mod_ssl.so - Uncomment by removing
#
the line Include/private/etc/apache2/extra/httpd-ssl.conf
- I don’t know if this set actually matters, but I did it. You need to edit the Virtual Host file
/etc/apache2/extra/httpd-vhosts.conf
and paste into the end of chunk of text. Go up to the link and grab the text.
At this point we diverge from the above link, I had tested and it didn’t work.
- Find your old downloads from Let’s Encrypt, the two PEM files. Rename fullchain.pem to server.crt and key.pem to server.key. I actually renamed them to the FQDN.*, so testserver.leobaeck.ca.key
- Move them into
/private/etc/apache2
- Edit
/private/etc/apache2/extra/httpd-ssl.conf
and find## SSL Virtual Host Context
- Make sure
DocumentRoot
is correct - Put in
ServerName
- Scroll down a bit more and put in
SSLCertificateFile
andSSLCertificateFile
- Save and exit
- Restart Apache
sudo apachectl restart