Article ID = 210
Article Title = How To Setup A Basic Web/Email Server With OS X/macOS + Server 5.x
Article Author(s) = Graham Needham (BH)
Article Created On = 23rd November 2017
Article Last Updated = 19th April 2019
Article URL = https://www.macstrategy.com/article.php?210
Article Brief Description:
How to setup and configure a basic internet/web/email server using OS X / macOS and Server 5.x
Go through each of the following sections in order:
SECURITY NOTE: Only the most recent versions of OS X / macOS are still supported with security updates. As a server is often open to the real world it is best to be running a supported OS:Mail
Click on 'Mail' on the left:
NOTE: If you actually have a web site at your_domain_name.co.uk you can edit it's settings and set the 'Store Site Files In' to point to a different folder in the web server Sites folder location
NOTE: Useful settings for each domain you add are:
If you need to run MySQL:
Login to OS X / macOS as root, go to Macintosh HD > Applications > Utilities > Terminal and issue this command:/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'NOTE: Make sure you use the single 'quotes' surrounding the password!
Article Title = How To Setup A Basic Web/Email Server With OS X/macOS + Server 5.x
Article Author(s) = Graham Needham (BH)
Article Created On = 23rd November 2017
Article Last Updated = 19th April 2019
Article URL = https://www.macstrategy.com/article.php?210
Article Brief Description:
How to setup and configure a basic internet/web/email server using OS X / macOS and Server 5.x
- Apache Web Server Download For Mac Os X
- Mac Os Server Manual
- Server Web For Mac Os 10.10
- Server Web For Mac Os High Sierra
How To Setup A Basic Web/Email Server With OS X / macOS + Server 5.x
SSL inspection and intercepting proxies are also not supported for security reasons. Configure an exception for SSL inspection and your proxy server to directly pass through data from Microsoft Defender ATP for Mac to the relevant URLs without interception. Adding your interception certificate to the global store will not allow for interception. Install and Configure MAMP (Mac, Apache, MySQL, PHP) This is an open-source program that gives. MacOS Server brings even more power to your business, home office, or school. Designed to work with macOS and iOS, macOS Server makes it easy to configure Mac and iOS devices. It’s also remarkably simple to install, set up, and manage. Add macOS Server to your Mac from the Mac App Store for just $19.99. Mac OS X Server Getting Started for Version 10.4 or Later Install Mac OS X Server and set it up for the first time. Mac OS X Server Upgrading and Migrating to Version 10.4 or Later Use data and service settings that are currently being used on earlier versions of the server. Mac OS X Server User Management for Version 10.4 or Later. OS X: You need only one tiny command to start a web server from any directory through OS X's terminal. If you've got a web site lying around and need to test it out, this is possibly the fastest.
WARNING: As of September 2018 Apple has gutted macOS Server and removed most/all of the useful Server features!Go through each of the following sections in order:
- Business Internet Connection (static IP + ability to server web sites/email)
- macOS 10.13 High Sierra + Server 5.4 - coming soon
Computer
Any Mac that can run OS X 10.10 Yosemite or later will do but we highly recommend the Mac mini - it is best to make sure the mini has:- The fastest processor you can afford - if you can get the older Mac mini (2010) with the quad core processor that is ideal
- 16GB of RAM/memory - if you have an older Mac mini you may be able to upgrade it to 16GB
- Solid State Drive (SSD) / Flash Storage - it is not recommended to run this kind of server from a Mac mini with a spinning hard disk, especially the slow 5400rpm versions
- 3.0GHz Dual-Core Intel Core i7 (Turbo Boost up to 3.5GHz)
- 16GB 1600MHz LPDDR3 SDRAM
- 256GB PCIe-based Flash Storage
OS X / macOS + Server
If your computer did not come with OS X 10.10 Yosemite or later / Server 4.x or later you will need to obtain the software:- OS X 10.10 Yosemite
- OS X 10.11 El Capitan
- macOS 10.12 Sierra
: This article is written specifically for OS X 10.11 El Capitan and macOS 10.12 Sierra. Due to major changes in macOS 10.13 High Sierra / Server 5.4, parts of this article do not apply/are not correct. We plan to write an article specifically dealing with setting up macOS 10.13 High Sierra / Server 5.4.
SECURITY NOTE: Only the most recent versions of OS X / macOS are still supported with security updates. As a server is often open to the real world it is best to be running a supported OS:
Q. What are the current, supported versions of macOS?
A. macOS 10.15 (Catalina), 10.14 (Mojave) and macOS 10.13 (High Sierra) are supported by Apple. The latest security updates are:- macOS 10.15 - included in the macOS 10.15.6 Combo Update
- macOS 10.14 - included in the macOS 10.14.6 Combo Update + Supplemental Update 2 (1st October 2020)
- macOS 10.13 - included in the macOS 10.13.6 Combo Update + Security Update 2020-005
- SECURITY WARNING: macOS 10.12 and earlier are no longer supported with security updates - see our securing older operating systems article.
Business Internet Connection (static IP + ability to serve web sites/email)
You need to host your server on an internet connection that allows for running a server - this is usually a business type service and not a 'home broadband package' as the latter will use block server protocols/ports and may not allow the running of a server as per the 'Terms And Conditions' of the service. A (business) internet connection usually consists of the following specific things:- Real world, internet based static IP address (see our Basic Networking 101 article)
- A (business) internet connection that allows you to run a server - the service's 'Terms And Conditions' specifically allow for running a server and no server ports/protocols are blocked
- A decent, guaranteed upload speed (which will be the speed people see when they access your server - not the download the speed
- A guaranteed uptime and either a proper, defined unlimited data service or a very high data cap based on the data that your server is likely to serve over the connection, over time
- OpenDNS - application
- DynDNS - application
- StaticCling - application
Domain Name(s)
You will need at least one domain name e.g. your_domain_name.co.uk - you can purchase this from many domain providers. Recommended domain providers:- Czech Republic domena.cz
- UK names.co.uk
- USA easyDNS
- An 'A' name record for 'your_domain_name.co.uk' should point to your static IP
- If you are hosting a web site on that domain you should also create a 'CNAME' record for 'www.your_domain_name.co.uk' that points to 'your_domain_name.co.uk'
- If you are hosting email on that domain you should also create a 'Mail Exchange' (MX) record that points to your static IP
Additional Hardware
If you need to rack mount your Mac there are several optionsYou should also consider an external hard disk for backing up your server:- External portable hard disks (small)
- G-Tech G-Drive mobile 5400rpm USB 3 + FireWire 800
- 500GB (model number = GDMOCEA5001ADB | part code = 0G02384)
- 750GB (model number = GDMOCEA7501ADB | part code = 0G02388)
- 1TB (model number = GDMOCEA10001ADB | part code = 0G02392)
- G-Tech G-Drive mini 7200rpm USB 3 + FireWire 800
- 500GB (model number = GDRMU3EA5001BDB | part code = 0G02569)
- 750GB (model number = GDRMU3EA7501BDB | part code = 0G02573)
- 1TB (model number = GDRMU3EA10001BDB | part code = 0G02577)
- LaCie Rugged Triple USB 3 + FireWire 800 NOTE: We do not recommend the LaCie Rugged Triple 1.5TB or 2TB models as they use two hard disks in RAID 0 mode which is catastrophic for your data if either drive fails.
- 500GB 5400rpm (part code = 301982)
- 500GB 7200rpm (part code = 301983)
- 1TB 5400rpm (part code = 301984)
- External desktop hard disks (full size)
- G-Technology G-Drive (Gen 6)
- G-Technology G-Drive 2TB (model number = GDREG6EB20001BDB | part code = 0G02920)
Buy it now at - G-Technology G-Drive 4TB (model number = GDREG6EB40001BDB | part code = 0G02928)
Buy it now at - G-Technology G-Drive (Gen 5)
- G-Technology G-Drive 2TB (model number = GT-GDREU3EB20001BDB | part code = 0G02529)
- G-Technology G-Drive 4TB (model number = GT-GDREU3EB40001BDB | part code = 0G02537)
- Seagate Backup Plus Desktop Drive for Mac 2TB (part code = STCB2000800)
- Seagate Backup Plus Desktop Drive for Mac 3TB (part code = STCB3000800) Buy it now at
- Western Digital My Book Studio USB2/FW800
- Western Digital My Book Studio 1TB USB2/FW800 (part code = WDBC3G0010HAL)
Buy it now at - Western Digital My Book Studio 2TB USB2/FW800 (part code = WDBC3G0020HAL)
Buy it now at - Western Digital My Book Studio 3TB USB2/FW800 (part code = WDBC3G0030HAL)
Buy it now at - Western Digital My Book Studio USB3/USB2
- Western Digital My Book Studio 1TB USB3/USB2 (part code = WDBCPZ0010HAL)
Buy it now at - Western Digital My Book Studio 2TB USB3/USB2 (part code = WDBCPZ0020HAL)
Buy it now at - Western Digital My Book Studio 3TB USB3/USB2 (part code = WDBCPZ0030HAL)
Buy it now at - Western Digital My Book Studio 4TB USB3/USB2 (part code = WDBCPZ0040HAL)
Buy it now at
Server Configuration
Initial Setup
- If you do not have OS X 10.10 / OS X 10.11 / macOS 10.12 download and install it:
- Especially if the Mac is not a brand new purchase, we highly recommend erase installing OS X / macOS to start with a perfectly clean installation/setup
- Go through the OS X / macOS setup using a strong password for the primary admin user SECURITY NOTE: Don't set up the primary admin user with the name 'admin' or a person's name as these will be too easy to guess, phished or obtained from publicly available company details!
- Update OS X / macOS:
- List of macOS 10.15 Combo Updates (latest version = 10.15.6)
- List of macOS 10.14 Combo Updates (latest version = 10.14.6)
- List of macOS 10.13 Combo Updates (latest version = 10.13.6)
- List of macOS 10.12 Combo Updates (latest version = 10.12.6)
- List of OS X 10.11 Combo Updates (latest version = 10.11.6)
- List of OS X 10.10 Combo Updates (latest version = 10.10.5)
- List of OS X 10.9 Combo Updates (latest version = 10.9.5)
- List of OS X 10.8 Combo Updates (latest version = 10.8.5)
- List of OS X 10.7 Combo Updates (latest version = 10.7.5) NOTE: Apple software updates/installers downloaded prior to 14th February 2016 have an expired security certificate. You should re-download any required/archived updates/installers.
- macOS 10.15 - included in the macOS 10.15.6 Combo Update
- macOS 10.14 - included in the macOS 10.14.6 Combo Update + Supplemental Update 2 (1st October 2020)
- macOS 10.13 - included in the macOS 10.13.6 Combo Update + Security Update 2020-005
- SECURITY WARNING: macOS 10.12 and earlier are no longer supported with security updates - see our securing older operating systems article.
- Download, install or purchase OS X / macOS Server:
- for macOS 10.12 ->How To Obtain/Download macOS Server 5.2-5.3.1
- for OS X 10.11 ->How To Obtain/Download OS X 5
- for OS X 10.10 ->How To Obtain/Download OS X Server 4/5
Initial Configuration
- Configure Apple menu > System Preferences > Network:
- Wi-Fi > switch off
- Keep ethernet, Wi-Fi and FireWire/ThunderBolt - remove all others ('-' button in bottom left)
- Set service order (cog icon > Set Service Order > drag 'Ethernet' to the top of the list)
- TCP/IP > set static IP address + DNS servers
- Configure Apple menu > System Preferences > Sharing:
- TICK 'Remote Sharing'
- Change computer name to something appropriate e.g. 'Internet Server'
- Under 'Allow access for:' set to 'Only these users' and add the primary admin user you created on initial setup
- TICK all items for admin user 'can access this computer to:'
- Configure Finder preferences (in the Finder click on the Desktop and go to Finder menu > Preferences)
- General - TICK all 'Show these items on the desktop' and set 'New Finder windows show' 'Applications' folder
- Sidebar - set as required but recommended to:
- UNTICK 'All My Files'
- UNTICK 'iCloud Drive'
- UNTICK 'AirDrop'
- UNTICK 'Back to My Mac'
- UNTICK 'Bonjour computers'
- TICK all items listed under 'Devices'
- Setup the Dock up as required e.g. remove non-server application icons
- Configure Apple menu > System Preferences:
- General:
- Set scroll bars as required
- TICK 'Ask to keep changes when closing documents'
- TICK 'Close windows when quitting an application'
- (if present) UNTICK 'Allow Handoff between this Mac and your iCloud devices'
- Screen Saver - set 'Start After' as required e.g. '5 Minutes'
- Security & Privacy:
- General tab > set Require password 'immediately' after sleep or screen saver begins
- General tab > set 'Allow apps downloaded from' to 'App Store and identified developers
- FileVault tab > turn FileVault on if you want to encrypt the internal boot drive NOTE: If you FileVault encrypt the internal boot drive manually rebooting the Mac requires a physical presence at the Mac - you cannot control it remotely to startup and login - so if the Mac is colocated, not easily accessible or headless/no monitor you may want to consider not encrypted the internal boot drive!
- Firewall tab > turn ON the Filewall
- (if present) CDs & DVDs - set all to ignore
- Energy Saver:
- Set 'Computer sleep' to 'Never'
- Set 'Display sleep' as required e.g. '30 minutes'
- UNTICK 'Put hard disks to sleep when possible'
- (if present) UNTICK 'Allow power button to put the computer to sleep'
- TICK 'Wake for network access'
- TICK 'Start up automatically after a power failure'
- (if present) UNTICK 'Enable Power Nap'
- App Store
- TICK 'Automatically check for Updates'
- UNTICK 'Download newly available updates in the background'
- UNTICK 'Install app updates'
- (if present) UNTICK 'Install OS X / macOS updates'
- TICK 'Install system data files and security updates'
- Bluetooth - UNTICK 'On' and untick 'Show Bluetooth in menu bar'
- If using Mac headless/no monitor click 'Advanced…' and UNTICK all 3 open/wake items
- Users & Groups > Login Options
- Set 'Automatic login' to 'Off'
- Set 'Display Login window as' as 'Name and password'
- UNTICK all other items
- (if present) Siri - turn OFF/UNTICK 'Enable Siri'
- Date & Time
- Date & Time - TICK 'Set date and time automatically'
- Time Zone - UNTICK 'Set time zone automatically using current location' if the server is not physically located in the timezone you want the server operating in
- Time Machine - set as required
- Startup Disk - make sure the correct startup disk is selected/highlighted
- Now restart the computer and untick 'Reopen windows when logging back in'
Install/Setup Additional Applications
We recommend the following:- A decent text editor that is better than TextEdit e.g. BBEdit (US$49.99)
- A launchd (plist) editor e.g. Lingon X (US$10.99)
- If you are going to install and use MySQL download a SQL graphical editor e.g. Sequel Pro (donationware)
- Add any new applications downloaded to the Dock
- Go to Macintosh HD > Utilities > Activity Monitor
- Right click on Activity Monitor's icon in the Dock and select Dock Icon > Show CPU Usage
- Right click on Activity Monitor's icon in the Dock and select Options > Keep in Dock
- Right click on Activity Monitor's icon in the Dock and select Options > Open at Login
Enable The Root User
- Go to Apple menu > System Preferences > Users & Groups
- Click the lock icon to unlock it and enter your administrator name and password
- Click 'Login Options' on the left and then click 'Network Account Server: Join'
- Click 'Open Directory Utility'
- Click the lock icon to unlock it and enter your administrator name and password
- Choose Edit > Enable Root User and then enter a strong root user password
- Logout
- Login as 'root' with the password you have just set
- 'Skip' the iCloud account setup
- Setup root's Finder preferences and Dock as required (see the initial configuration section above)
- Logout unticking 'Reopen windows when logging back in'
Secure Safari
Go to Safari menu > Preferences- General:
- Set 'Safari opens with:' to 'A new window'
- Set 'New windows open with:' to 'Empty Page'
- Set 'New tabs open with:' to 'Empty Page'
- Set 'Homepage' to nothing (delete whatever is there)
- UNTICK 'Open 'safe' files after downloading'
- Autofill > UNTICK all items/everything
- Security > TICK all items/everything
- Advanced > TICK 'Show full website address'
Initial Server Configuration
- Go to Macintosh HD > Applications > Server
- Enter your host name as required e.g. your_domain_name.co.uk
- Apple Push Notifications > leave fields blank and click 'Continue'
- Click Finish when setup is complete
- You will be presented with the server 'Overview'
- Click on 'Settings' and configure access as required
- Your are highly recommended to turn on the OS X / macOS Server adaptive firewall
Alerts
Click on 'Alerts' on the left and then 'Delivery' on the right:- Click 'Edit Recipients' under 'Email Recipients' and add email address(es) that you want alerts to be sent to
- Under 'Delivery Settings' we recommended turning on/TICKING:
- Certificate
- Disk
- Network Configuration
- Software Update
- Time Machine
Certificates
Click on 'Certificates' on the left:- Set 'Secure services using' as required and add additional certificates if you have them NOTE: more information about certificates
Users
Click on 'Users' on the left:- Add users as required (+ button at the bottom). For each user:
- Add associated 'Email addresses' as required
- If the user is not going to administer the server make sure to UNTICK 'administer this server'
- If the user is only accessing services e.g. email set 'Home Folder' to 'None - Services Only'
- Add the user to 'Groups' as required NOTE: If you're going to use FTP to upload files why not set up an 'ftpuser' or similar for that purpose (but make sure they have a 'Home Folder' set to 'Local Only' or they will not be able to use the FTP service).
- Once a user has been created in the main user list you can select a user and click the cog button at the bottom for:
- Edit Access to Services… - if you click 'Manage Service Access' here you can set on an individual basis what services can be accessed by that user otherwise all basic services are accessible to all users by default. It is recommended to manage services manually and set the services required for each individual user as required.
- Edit Mail Options… - you can choose whether email for that user is stored locally or forwarded to a different address. You can also set an email limit (size of individual email) here for the individual user
Groups
Click on 'Groups' on the left:- Add groups as required - this is useful for setting group email addresses e.g. an email going to messages@your_domain_name.co.uk will be received by all the users in that group:
- To create an email group, add a group, then right click on it choosing 'Edit Group…'
- For 'Mailing Lists' add the group email address including the domain name
- Add 'Members' as required
- For 'Domains':
- Add email domains as required
- For each domain set the users that need email via that domain i.e. user_name@domain_name.com
- Authentication: probably best to leave it on Automatic but you can customise it by clicking 'Edit…' to the right - options are:
- Automatic - will authenticate users against all accounts
- Open Directory - open directory users only
- Active Directory - Active Directory (AD) users only (if server is linked to one)
- Local users - local user accounts only
- Custom - customise the authentication options
- Click 'Edit Filtering Settings…'
- Enable virus filtering
- Enable blacklist filtering
- Enable greylist filtering if required - see the notes on screen
- Enable junk mail filtering
- Use any modern mail client
- Set up accounts as POP or IMAP as required
- Must login and add login for SMTP authentication
- Must use SSL (see Certificates above)
Web Sites
Click on 'Websites' on the left:- TICK 'Enable PHP' if required
- The default web site is automatically setup for the domain you entered for the original server setup e.g. your_domain_name.co.uk
NOTE: If you actually have a web site at your_domain_name.co.uk you can edit it's settings and set the 'Store Site Files In' to point to a different folder in the web server Sites folder location
NOTE: Useful settings for each domain you add are:
- To add a different domain e.g. www.your_domain_name.co.uk and/or www.youradditionaldomain.com click the + button and enter the settings for your domain
- SSL Certificates: set a certificate if required and it is installed
- Store Site Files In: use the default 'Automatically create a new folder' option as this creates a correctly named folder with the right permissions in the Sites folder
- Additional domains: this is great for two reasons
- you have multiple domains pointing to the same web site e.g. www.your_domain_name.com and www.your_domain_name.co.uk
- you can add the root domain e.g. your_domain_name.co.uk (without the www bit) so that accessing http://your_domain_name.co.uk works
- Index Files: you can set the required index file name or have more than one and drag them in priority order
- Edit Advanced Settings:
- Generally you will want all of these unticked
- Use custom error page: this looks like a great option but we couldn't get it to work
- Once you domain has been created a folder appears in the Sites location. You can delete any default files found in there ready for your web site files to go in it.
FTP
- Create an FTP user if not already created (services only user)
- Click on 'FTP' on the left
- Select 'Websites Root' from the 'Share:' pop-up menu and then add (+ button) your FTP user with the 'Read & Write' privilege
- Select each web site you are sharing from 'Share:' pop-up menu and then add (+ button) your FTP user with the 'Read & Write' privilege - you have do this for all the web sites NOTE: Or you can login as root and use the Finder to add the user at the Sites folder level and copy all permissions to files and folders in this folder.
NOTE: The primary login directory will be the one that is currently set in the FTP settings screen - be careful what you leave it on if you have more than one FTP share point.
NOTE: If you copy files to the FTP folder(s) using the Finder the permissions will not be set correctly on the files you copy. Once you've copied the files go to your site folder, Get Info on it, unlock it (bottom right) and select 'Apply to enclosed items…' from the wheel pop-up menu just to the left of the lock icon. This will propagate the permissions down to all the files/folders you've copied within that site folder. Use FTP from then on.
SECURITY NOTE: Because the FTP user has to have a local share point to access the FTP service the FTP user will have the ability to physically login to the computer at the login screen and access the Finder (they can't access the server admin tools as they are not allowed to 'administrate' the server but access to the Finder is bad enough - this is a major security risk if the server is not in a secure location e.g. server room/house. If it's not consider using a different method/software to get web site files on to the server.
Install And Configure MySQL
NOTEApache Web Server Download For Mac Os X
: The latest version of MySQL with security updates is no longer supported on macOS 10.12 Sierra.If you need to run MySQL:
- Download and install MySQL e.g. 5.7.x > Community Server 'Mac OS X 10.12 (x86, 64-bit), DMG Archive' - check the OS requirements
- Go to Apple menu > System Prefernces > MySQL
- TICK 'Automatically Start MySQL Server on Startup' (if not already ticked)
- Click 'Start MySQL Server'
Set The MySQL Root Password
NOTE: This is not the same as the OS X / macOS root or admin password - this is a unique password to the MySQL root user, set a secure password and make sure you can remember what it is.Login to OS X / macOS as root, go to Macintosh HD > Applications > Utilities > Terminal and issue this command:/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'NOTE: Make sure you use the single 'quotes' surrounding the password!
Automate MySQL Dump Backups
- Login as root
- Create a 'Backups' folder (in a relevant location usually the root of the primary hard disk will do)
- Use a text editor e.g. BBEdit to create a MySQL dump backup command file e.g. NOTE: Name it something like 'mysql_backup_monday.command'.
- Use a launchd (plist) editor e.g. Lingon X to add a launchd automated task, running as root, to run the backup command you just created and pick a regular day and/or time. For example to trigger your mysql dump script to run every Monday at 01:00:
- Create a new task
- TICK 'Enabled'
- Set 'User' to 'root'
- Name = 'com.your_domain_name.sqlbackupmonday.plist' NOTE: plists are saved to Macintosh HD > private > var > root > Lirbary > LaunchAgents.
- Run = point this to the location of the backup command script you created above
- When tab > TICK 'Scheduled'
- Set schedule to 'Day of week' + 'Monday' + '01:00'
- Click 'Save'
- To test it works, select it and click the 'Test' button - if there are no error messages you can check the script has run correctly by checking that a mysql dump backup file has been created
- If you want a single mysql dump file that replaces itself each day you could just set the naming and launchd plist to run every weekday. But this may not be wise, because if something goes wrong, you only have the one backup dump file and if that is corrupted/bad the older ones are gone. Therefore, as per the recommendation above, create a 'Monday' backup command script, duplicate that script in the Finder and edit the names to represent each day and add additional launchd plists to run each day - that way you have backups for every day. You could even go insofar as to create and run backup scripts at a different time of the day for example, weekly (02:00), monthly (03:00) and yearly (04:00). If you are manually creating/editing the launchd plist files:
- Example launchd plist file:
- line 6 filename (must match the Finder name)
- line 9 the command
- lines 14, 16, 18 timing (day, hour and minute as required)
- or lines 14, 16, 18 timing (hour, minute and weekday as required)
- Move the plist file(s) to Macintosh HD > System > Library > LaunchDaemons
- Restart the server
- Login as root
- In the Terminal run 'launchctl list' to check your plist(s) have loaded (should show in the list with a status of '0' - zero)
NOTE: You can test the final command line works by pasting it directly into the Terminal and checking that a mysql dump backup file has been created.
Article Keywords: OS X OSX 1010 1011 macOS 1012 Yosemite El Capitan Sierra Server 4 5 internet web email SMTP POP PO3 IMAP secure SSL certificate apache php mysql ftp multiple virtual host hosts domain domains name names mail exchange A NAME CNAME DNS static IP colocate colocation co-locate co-location groups aliases alias backup time machine rack mount rackmount dump plist cron job cronjob launchd automate automatic regular
This article is © MacStrategy » a trading name of Burning Helix. As an Amazon Associate, employee's of MacStrategy's holding company (Burning Helix sro) may earn from qualifying purchases. Apple, the Apple logo, and Mac are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc.
If this information helped you or saved you time and/or money why not donate a little to us via PayPal?
All proceeds go directly to MacStrategy / Burning Helix Limited to help fund this web site.
All proceeds go directly to MacStrategy / Burning Helix Limited to help fund this web site.
If this information helped you or saved you time and/or money why not donate a little to us via PayPal?
All proceeds go directly to MacStrategy / Burning Helix Limited to help fund this web site.
Go to this
web page
to donate to us.
All proceeds go directly to MacStrategy / Burning Helix Limited to help fund this web site.
Go to this
web page
to donate to us.
25 20 likes 19,332 views Last modified Oct 9, 2019 6:12 PM
Here is my definitive guide to getting a local web server running on OS X 10.15 “Catalina”. This is meant to be a development platform so that you can build and test your sites locally, then deploy to an internet server. This User Tip only contains instructions for configuring the Apache server, PHP module, and Perl module. I have another User Tip for installing and configuring MySQL and email servers.
Note: This user tip is specific to macOS 10.15 “Catalina”. Pay attention to your OS version. There have been significant changes since earlier versions of macOS.Another note: These instructions apply to the client versions of OS X, not Server. Server does a few specific tricks really well and is a good choice for those. For things like database, web, and mail services, I have found it easier to just setup the client OS version manually.
Requirements:
- Basic understanding of Terminal.app and how to run command-line programs.
- Basic understanding of web servers.
- Basic usage of vi. You can substitute nano if you want.
Optional: Xcode is required for adding PHP modules.
Lines in bold are what you will have to type in. Lines in bold courier should be typed at the Terminal.Replace <your short user name> with your short user name.
Here goes.. Enjoy!
To get started, edit the Apache configuration file as root:
sudo vi /etc/apache2/httpd.conf
Enable PHP by uncommenting line 186, changing:
#LoadModule php7_module libexec/apache2/libphp7.so
to
Mac Os Server Manual
LoadModule php7_module libexec/apache2/libphp7.so
(If you aren't familiar with vi, go to line 186 by typing '186G' (without the quotes). Then just press 'x' over the '#' character to delete it. Then type ':w!' to save, or just 'ZZ' to save and quit. Don't do that yet though. More changes are still needed.)
If you want to run Perl scripts, you will have to do something similar:
Enable Perl by uncommenting line 187, changing:
#LoadModule perl_module libexec/apache2/mod_perl.so
to
LoadModule perl_module libexec/apache2/mod_perl.so
Enable personal websites by uncommenting the following at line 183:
#LoadModule userdir_module libexec/apache2/mod_userdir.so
to
LoadModule userdir_module libexec/apache2/mod_userdir.so
and do the same at line 520:
#Include /private/etc/apache2/extra/httpd-userdir.conf
to
Include /private/etc/apache2/extra/httpd-userdir.conf
Now save and quit.
Open the file you just enabled above with:
sudo vi /etc/apache2/extra/httpd-userdir.conf
and uncomment the following at line 16:
#Include /private/etc/apache2/users/*.conf
to
Include /private/etc/apache2/users/*.conf
Save and exit.
Lion and later versions no longer create personal web sites by default. If you already had a Sites folder in Snow Leopard, it should still be there. To create one manually, enter the following:
mkdir ~/Sites
echo '<html><body><h1>My site works</h1></body></html>' > ~/Sites/index.html.en
While you are in /etc/apache2, double-check to make sure you have a user config file. It should exist at the path: /etc/apache2/users/<your short user name>.conf.
That file may not exist and if you upgrade from an older version, you may still not have it. It does appear to be created when you create a new user. If that file doesn't exist, you will need to create it with:
sudo vi /etc/apache2/users/<your short user name>.conf
Use the following as the content:
<Directory '/Users/<your short user name>/Sites/'>
AddLanguage en .en
AddHandler perl-script .pl
PerlHandler ModPerl::Registry
Options Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride None
Require host localhost
</Directory>
Now you are ready to turn on Apache itself. But first, do a sanity check. Sometimes copying and pasting from an internet forum can insert invisible, invalid characters into config files. Check your configuration by running the following command in the Terminal:
apachectl configtest
If this command returns 'Syntax OK' then you are ready to go. It may also print a warning saying 'httpd: Could not reliably determine the server's fully qualified domain name'. You could fix this by setting the ServerName directive in /etc/apache2/httpd.conf and adding a matching entry into /etc/hosts. But for a development server, you don't need to do anything. You can just ignore that warning. You can safely ignore other warnings too.
Turn on the Apache httpd service by running the following command in the Terminal:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
USB 2.0 plays video/music from USB flash/hard disk driveThe Universal Serial Bus or USB is an industry standard that allows high-speed, easy connection of peripherals to PCs, consumer electronics and mobile products. Philips myremote for mac. The USB 2.0 provides better and faster performance - up to 40 times quicker than the USB 1.0 and with a data transfer rate of up to 480 Mbps from the original 12 Mbps.
In Safari, navigate to your web site with the following address:
It should say:
It works!
Now try your user home directory:
http://localhost/~<your short user name>
It should say:
My site works
Now try PHP. Create a PHP info file with:
echo '<?php echo phpinfo(); ?>' > ~/Sites/info.php
And test it by entering the following into Safari's address bar:
http://localhost/~<your short user name>/info.php
You should see your PHP configuration information.
To test Perl, try something similar. Create a Perl test file with:
echo 'print $ENV{MOD_PERL} . qq{n};' > ~/Sites/info.pl
Server Web For Mac Os 10.10
And test it by entering the following into Safari's address bar:
http://localhost/~<your short user name>/info.pl
You should see the string 'mod_perl/2.0.9'.
If you want to setup MySQL, see my User Tip on Installing MySQL.
If you want to add modules to PHP, I suggest the following site. I can't explain it any better.
If you want to make further changes to your Apache system or user config files, you will need to restart the Apache server with:
Server Web For Mac Os High Sierra
sudo apachectl graceful