Install the website template

A bare website template using the BlueMvc framework can be downloaded directly via Composer. This template can be a good starting point for your own website and will be used in this tutorial.

Install with Composer

Run the following command from the command prompt where /path/to/webroot is the path to your empty web root.

$ composer create-project bluemvc/bluemvc-website /path/to/webroot

The website template will now be downloaded and all required dependencies will be installed. Press Enter if prompted whether you want to remove existing VCS files.

Set up the web server

If you have started a Vagrant instance using the Vagrantfile from the previous page, the web server is already set up and this step can be skipped.

The web server needs to set up to route all requests for non-existent files to /path/to/webroot/Public/index.php. How this is done depends on the web server used.

Apache example configuration

<VirtualHost *:80> DocumentRoot /path/to/webroot/Public RewriteEngine on RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f RewriteRule . /index.php [L] SetEnv BLUEMVC_DEBUG 1 </VirtualHost>

Nginx example configuration

server { listen 80; root /path/to/webroot/Public; location / { try_files $uri /index.php; } location ~ \.php$ { # Insert PHP FastCGI configuration here. fastcgi_param BLUEMVC_DEBUG 1; } }

Check the installation

Use your browser to navigate to the url corresponding to the web server set up above. For this tutorial we will assume http://localhost/.

A page similar to this should be displayed:

Template installed

Congratulations! You have now successfully installed the BlueMvc website template.

✎ Published in category get started