Now, we need to setup our server so that we can access the site. I'm doing all of this locally on a Mac with MAMP, so you're mileage may vary, but the concepts are the same.
First, I'll create a database for my site to use. Again, I'm using MAMP, so you might have to create the database another way.
- Go to "localhost/phpmyadmin" in your web browser.
- Click "New"
- Enter the database name and choose utf8_general_ci
- Click "Create"
Add site to hosts file
Now, I'll add the site to my hosts file so that I can access it at an easy-to-remember domain name.
Edit the hosts file
sudo vi /etc/hosts
Add the domain you want to use
Now, I just need to setup the vhost file so that my server (my local machine, in this case) knows where the project's docroot is.
You'll notice that my DocumentRoot is the "/web" sub-directory of the project. The drupal-composer/drupal-project we're starting from creates that directory by default. It's best-practice in Drupal 8 to have a sub-directory be your document root so that you can keep project dependencies like Behat and PHPUnit in your repository, but outside of the web root. It also allows you to keep things like Configuration files (from Drupal's Configuration Management system) in the Git repository, but again outside of the web accessible directory.
Once you have your hosts file and vhost file updated, you'll need to restart the server. ie: MAMP