I got my new iMac thinking it would be relatively easy to use it as a Web server. There are a couple of different ways of doing this depending on whether you are going to be using it as a development machine or if you want to use it as Web server hosting sites on the internet.
Development Server Setup Using Mamp Pro
Mamp Pro is a program that lets you easily set up virtual hosts and controls whether either the Apache or Nginx servers are running. You can set up as many hosts as you want. They have a free version that can create one host, but if you need to create multiple sites you will want to go with Mamp Pro.
If all you are doing is setting up WordPress sites and testing them locally, this is an option that will get you up and running quickly and relatively cheaply at $69.
You can also set up your machine to use the version of Apache that comes as part of the Mac operating system.