Coolestguideontheplanet.com always has been my go-to spot for macOS upgrades and I'll be borrowing for some of the steps as it'll get you about halfway to enabling localhosts.

You'll need to either use a CLI utility like Nano or BBEdit. If using BBEdit, you will need to click the "Show Everything" box to view invisible files.

Step 1: Modify the httpd.conf

Open the httpd.conf

  sudo nano /etc/apache2/httpd.conf
  

Uncomment the following lines by removing the # in front of the line

  Include /private/etc/apache2/extra/httpd-vhosts.conf
  LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
  LoadModule rewrite_module libexec/apache2/mod_rewrite.so
  LoadModule php7_module libexec/apache2/libphp7.so
  

Step 2: Modify the Vhosts.conf

Open the vhost.conf (Note if you've upgraded, macOS should have the httpd-vhosts.conf~previous in the same directy) configuration

  sudo nano /etc/apache2/extra/httpd-vhosts.conf
  

Entries are added by using the following pattern.

  <VirtualHost *:80>
  ServerAdmin webmaster@dummy-host2.example.com
  DocumentRoot "/usr/docs/dummy-host2.example.com"
  ServerName dummy-host2.example.com
  ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
  CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
  </VirtualHost>
  

Here's an example of a working entry ported from macOS (OS X) 10.12.x

  <VirtualHost *:80>
        DocumentRoot "/Users/MYUSER/Development/website"
        ServerName mysite.lvh.me

    <Directory  "/Users/MYUSER/Development/website">
                AllowOverride All
                Require all granted
    </Directory>
      </VirtualHost>

    

Step 3: Map Localhost to hosts

Open the hosts file:

  sudo nano /etc/hosts
  

Important, this next step can vary quite a bit based on how you've mapped your vhosts URLs. I decided I want all instances of localhost AND lvh.me (lvh being the acrnynom many developers use for local virtual host and the dot me suffix to reinforce that it is local). This is super common.

    127.0.0.1	localhost
    127.0.0.1 lvh.me
  

Step 4: Restart Apache

Regardless if you were using a GUI editor like BBEdit, you'll need to restart Apache via the command line

  sudo apachectl restart