How to setup a WordPress site on a Mac mini running OS X Server Yosemite
I have an internet-hosted Mac miniskirt running OS X Server, and recently decided to figure out how to host websites on it, and in particular, WordPress websites. After a few struggles and speed bumps, I last got a web site up and running, and wanted to document the process here, pulling together the respective bits of information I compiled along the way .
Enabling websites in the Server.app
I wanted to setup my web site using the stock OS X Server resources, and without using something pre-packaged like MAMP. So the first pace was starting Server.app, version 4 for OS X 10.10 Yosemite, connecting to my miniskirt, turning on Websites, and enabling PHP web applications ( since WordPress is a PHP application ).
Changing the Apache user and group
When you create websites using Server.app, its default placement for storing your web site files is :
My preference, however, is to store my files in the Sites directory in my home folder :
In arrange for WordPress ’ s one-click updating to work, the Apache web server process needs permission to write into the booklet containing your web site files. The way I chose to accomplish this was to run Apache under my local anesthetic drug user ’ second name and group, rather of the default Apache user/group—_www/_www .
Achieving that requires editing the Apache config file, which for OS X Server is located in :
only the etymon exploiter can edit this file, and I know next to nothing about editing files in a Terminal windowpane. In ordering to edit the file remotely using BBEdit, I needed to be able to login to the machine as ancestor using BBEdit, which I accomplished by adding my SSH key to root ’ second authorized_keys file. I already had my SSH key in my local drug user ’ randomness authorized_keys file, and was able to safely get it into ancestor by doing the take after ( note that it was the only entrance in my authorized_keys file ) :
sudo su - root cat /Users/matt/.ssh/authorized_keys >> /var/root/.ssh/authorized_keys
once BBEdit could login as rout, I could then edit the Apache shape file, changing the default user/group ( i.e. _www/_www ) to that of my local anesthetic drug user. ( Remember that Apache needs restarting after making this change. )
Creating the new site in Server.app
back in Server.app, I created a newly site, leaving all the default settings in place, except for the specification of a non-default placement for the web site files, as mentioned earlier in this article. The compensate melt of WordPress requires entree control condition via an .htaccess file. By default, OS X Server prefers to control access with its own users & groups settings. You can override this on a per-site basis by clicking “ Edit Advanced Settings ” and enabling the .htaccess setting.
WordPress requires a MySQL database. The easiest way to install MySQL is running the succeed command from the Terminal, which downloads and executes a handwriting maintained by the folks at Mac Mini Vault .
bash The script downloads and installs MySQL, installs a preference pane from which you can start and stop the waiter, sets up the server ’ s settle password and copies that password for you to a text file on the desktop. For me, that all worked fine except the partially about setting the root password. A note on the handwriting hints that it needs tweaking for Yosemite, and that an update will be available on December 9th. nowadays ’ s December 10th, so I guess they ’ re still working on it. In any shell, I was able to set the MySQL beginning password by doing the following from the Terminal ( inserting my password in the quotes, of course ) :cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
Creating the WordPress database
once MySQL was up and running, I used Sequel Pro to connect to my mini securely via SSH, and create the database table I would use for my WordPress locate .
Installing WordPress 4
The easiest separate was installing WordPress, which merely involved going to wordpress.org, downloading WordPress 4, and unpacking its files in the booklet I ’ vitamin d created to contain my web site. After that was done, I renamed
wp-config.php, opened it in BBEdit, and edited the MySQL username and password and the identify of the database I ’ d created for the web site. And with that done, I visited my newfangled web site in a browser, and was successfully greeted with the WordPress installation and frame-up screen. Yeah !
Restoring from VaultPress
I use VaultPress to maintain a backup of my this web log, which besides runs WordPress. And so while setting up a new WordPress site on my miniskirt, I thought I ’ five hundred test out VaultPress ’ s ability to restore a backed-up WordPress site to an alternate localization, e.g. for times when you might want to migrate your web site from one host to another. In VaultPress, I simply provided the SSH login details to the my miniskirt, and clicked go. The process went absolutely smoothly and within a pair of moments I was looking at a pristine copy of my web log running on my Mac mini .
Performance of a Mac mini vs DreamPress
My Mac mini is a late 2012 Server model, non-SSD disks, 8GB of memory, and a 2.3GHz Intel Core i7 processor. My web log is hosted in a “ DreamPress ” installation at DreamHost, which involves a pair of specially-tuned VPSs ( virtual private servers ), one for the WordPress facility and one for the database server. I couldn ’ thyroxine find memory and processor specifications for the DreamPress product ( they lone mention auto-scaling resources ), and so a direct comparison to the Mac mini ’ mho resources wasn ’ metric ton potential.
Read more: ESPN - Wikipedia
In order to get a sense of the relative performance, I just did some click around in the WordPress Dashboard, and timed how long it took different screens to load. ( Since the public locate is heavily cached, being logged into the Dashboard is necessary to assess performance. ) In about all cases, the screens served by DreamPress loaded about twice as fast as those served by the Mac miniskirt. Quite unscientific, but an matter to data point however. ( On the other hand, the pages served by the mini seem about five times, or more, faster than those served by Dreamhost ’ s cheaper shared host. )
Since writing this article, I 've moved my WordPress host to DigitalOcean. here 's an article explaining why and how .