Categories
Web Development

Setting up a Local Domain

MAMP

Before attempting to setup a local domain ensure MAMP has the following setting:

  1. Ports
    • Apache 80
    • Nginx 7888
    • MySQL 3306
  2. Web Server
    • Server Apache
    • Document Root Applications/MAMP//htdocs (or personal preference)

Local Domains

  1. Create the local URL you want to use
    • Go to Macintosh HD/private/etc/hosts
    • At the bottom add….

      127.0.0.1 example.ld
    • Save file
  2. Ensure Virtual Hosts is enabled in your server Conf file
    • Go to Applications/MAMP/conf/apache/httpd.conf
    • Uncomment the following line…

      Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    • Save file
  3. In the Virtual Hosts file configure your local domain settings
    • Go to Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    • At the bottom adding the following:

      <VirtualHost *:80>
      ServerAlias example.ld
      ServerAdmin [email protected]
      DocumentRoot /Applications/MAMP/htdocs/example
      </VirtualHost>

Testing

To test your domain is working, go to the following URL

  • http://example.ld