setting up Silverstripe 4 environment

Here are the instructions for Ubuntu 16.04 for setting up a generic apache configuration for silverstripe 4 projects with a public folder. 

Allow access for apache: sudo nano /etc/apache2/apache2.conf ...

Then search for the area where /var/www is granted access and copy it as a ss4 version in the same document. Adding the following lines:

<Directory /var/ss4/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

Next, you add the following file to your sites available and enabled: (e.g. sudo nano /etc/apache2/sites-enabled/ss4.conf

<VirtualHost *:80>

        ServerName ss4
        ServerAlias ss4 *.ss4

        DocumentRoot /var/ss4
        VirtualDocumentRoot /var/ss4/%-2+/public/

        <Directory />
                Options FollowSymLinks
                AllowOverride None

        <Directory /var/ss4 >

            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all


        ErrorLog ${APACHE_LOG_DIR}/error.log

        LogLevel debug


Next, you edit the following file: sudo nano /etc/hosts, by adding the following line:       ss4

Now you restart apache: sudo service apache2 restart, and you are in business.

You can clone your project in /var/ss4. For example, load your project into: /var/ss4/ and then you can access the site as from your browser.