OS X Server is truly a Swiss-army knife of applications and services. Like many other server operating systems, it offers many of the standard issue services, such as file sharing, directory access, and user management to name a few.
Where OS X Server shines, however, is in its ability to offer all of the same services in one lightweight and powerful package, married to an easy-to-use management interface that makes even the most daunting tasks simple to execute.
Hosting your own website can be a tricky proposition. Between the bandwidth considerations, server hardware, and utilities that run the equipment, it's not for everyone — especially when hosting service providers make it so easy to gain web presence and literally take most of the security risk involved with hosting a site. However, if your website hosts private information and/or there are strict regulations overseeing the care and management of the data housed on your web servers, hosting your site(s) shouldn't be mission impossible.
Built in to Apple's OS X Server is the capability to manage your very own web server. With OS X Server's Websites service, you can host multiple websites — and you can host them based on unique IP addresses and ports, plus you can encrypt communications using SSL. Ultimately, you're only limited by the resources available to your server and through your ISP.
Here are the requirements for hosting a website on OS X Server:
- Computer running Apple OS X Server (10.7+)
- Broadband internet access (Ethernet preferred)
- Registered Domain Name
- Static IP address (optional; only if required)
- 3rd-party SSL certificate (optional; only if encryption is required)
- Hard drive storage space for hosting website files
OS X Server is a full-fledged web server. Let's take a closer look at how to configure a self-hosted website.
- Launch Server.app from the Applications folder.
- Login to the desired server your wish to manage by selecting it from your list and entering the administrative credentials.
- Select Websites from the Services pane (Figure A).
- The Websites service is off by default. However, other services — such as Profile Manager and Wiki — rely on this service to be enabled in order to function. If it's disabled, click the switch to the ON position to enable it.
- OS X Server includes a default webpage that is loaded by default and accessible from all IP addresses assigned to that server. From OS X Server 10.9+, there is no way to remove this default page without causing minor issues to creep up in the future. Adding new websites to host will supersede the default page. Click on the plus sign [+] to begin adding the first website (Figure B).
- Enter the domain name of the site you wish to add. Include information specific to accessing your website, such as IP addresses and port numbers that these websites may be connected to. If SSL encryption is required, click on the drop-down menu next to SSL Certificate to add a 3rd-party SSL certificate for more security (Figure C).
- Site files, which are the files that are created on the webserver that store your webpages, will be created by default, as websites are added within a new folder so as to not get mixed in with another site's files. However, if you wish to store these files in a different directory, click the drop-down menu next to Store Site Files In: to manually select a directory of your choosing.
- By default, websites are accessible by anyone anonymously. Modifying the settings next to Who Can Access: will allow the web administrator to control who can access the website.
- Clicking the Edit... button next to Additional Domains will allow alternate domain names to be added to the list. This is useful when using subdomains to access certain portions of a website. For example, apple.com uses a subdomain of store.apple.com to point users to its storefront. Clicking the plus sign [+] will add the new domains to the list, and clicking OK will save the configuration (Figure D).
- Clicking the Edit... button next to Redirects will allow the addition of domain names, IP address, and/or URLs to the list. This is useful when you need to direct users from, say, an old page or link to a new web page. Click the plus sign [+] to add the new URLs to the list, and click OK to save the configuration (Figure E).
- Clicking the Edit... button next to Aliases allows you to add privately stored folders on the server and make them publicly accessible as links. This is used primarily when storing content on a specific folder, such as an FTP share that is used internally and may need to be accessed externally as well. Click the plus sign [+] to add the new domains to the list, and click OK to save the configuration (Figure F).
- Clicking the Edit... button next to Index Files controls the list of possible index files to be recognized by this particular website. Since certain websites operate in a PHP environment or require specific commands to be run, this allows only the necessary index files from being utilized when accessing the site. All other index file types should be removed for security purposes. Click the plus sign [+] to add the new domains to the list, and then click OK to save the configuration (Figure G).
- Advanced Settings will allow specific settings to be enabled, which may impact the use of your site or the way it may be viewed. All settings are disabled by default, but checking the box next to the desired setting and clicking the OK button will enable the feature and save the configuration (Figure H).
- Upon completing the entries for the website, click the Create button to commit the changes to memory. Changes usually happen right away. However, this ultimately depends on the resources available on your server. Once the directory has been completed for your website entry, the screen will revert back to the Websites service pane, and you'll notice your website entry under the Websites category (Figure I).
- Under the Settings category, there are two checkboxes that govern the use of PHP and Python web applications respectively. Again, this is disabled by default. Checking the box next to either of these settings will enable that web application to function within all the sites added to Websites. Yes, unfortunately, this is a global settings change and not a per-website change. While security best practices would dictate that access should be granted as needed, this is a case where it's either enabled for all or disabled for all (Figure J).
- That's it! The Websites service is now configured, and the correct directory structure has been created by linking the website entry. Now, the only thing left to do is to copy (or create) your website files within the newly created directory to bring your website to life.
OS X Server is far from perfect. The Websites service, in particular, would benefit from advanced control features and management over the service itself. The upside, though, is that OS X Server is still a rock-solid Server OS, meaning the services are mature, tested, and scalable to meet the needs of most. It also requires a relatively low learning curve. Furthermore, those with an inclination for managing more of the clandestine website service features may do so from the Terminal, as Apple has included much of what can be done through the Server.app GUI — but everything can be done through the Terminal.
With that said, a word of warning: Take great care making changes to the Website service. Make backups of existing databases prior to making changes, and try to stick to one method of making changes — either GUI or Terminal. Most importantly, never try to directory edit the configuration files unless otherwise directed to do so by Apple, because that could be a recipe for disaster.
Do you have experience configuring websites on OS X Server? Share your experience, including your trials and tribulations, in the discussion thread below.
Jesus Vigo is a Network Administrator by day and owner of Mac|Jesus, LLC, specializing in Mac and Windows integration and providing solutions to small- and medium-size businesses. He brings 19 years of experience and multiple certifications from several vendors, including Apple and CompTIA.