matheusvcorrea/sample-cms-markdown

Sample Markdown CMS application

dev-master 2016-07-23 21:27 UTC

This package is not auto-updated.

Last update: 2024-12-19 03:31:54 UTC


README

Introduction

This is a simple, Sample Markdown CMS using the ZF2 MVC layer and module systems.

Installation using Composer

The easiest way to create a new project is to use Composer. If you don't have it already installed, then please install as per the documentation.

Create your new Sample Markdown CMS project:

composer create-project -n -sdev matheusvcorrea/sample-cms-markdown path/to/install

Config

Doctrine Connection

Connection parameters can be defined in the application configuration in config/autoload/doctrine.local.php:

<?php
return array(
    'doctrine' => array(
        'connection' => array(
            // default connection name
            'orm_default' => array(
                'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'username',
                    'password' => 'password',
                    'dbname'   => 'database',
                )
            )
        )
    ),
);

Sample Data

Import the SQL sample data located in data/sample-data.sql.

Web server setup

PHP CLI server

The simplest way to get started if you are using PHP 5.4 or above is to start the internal PHP cli-server in the root directory:

php -S 0.0.0.0:8080 -t public/ public/index.php

This will start the cli-server on port 8080, and bind it to all network interfaces.

Note: The built-in CLI server is for development only.

Apache setup

To setup apache, setup a virtual host to point to the public/ directory of the project and you should be ready to go! It should look something like below:

<VirtualHost *:80>
    ServerName markdown.localhost
    DocumentRoot /path/to/sample-markdown-cms/public
    <Directory /path/to/sample-markdown-cms/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
        <IfModule mod_authz_core.c>
        Require all granted
        </IfModule>
    </Directory>
</VirtualHost>

Nginx setup

To setup nginx, open your /path/to/nginx/nginx.conf and add an include directive below into http block if it does not already exist:

http {
    # ...
    include sites-enabled/*.conf;
}

Create a virtual host configuration file for your project under /path/to/nginx/sites-enabled/sample-markdown-cms.localhost.conf it should look something like below:

server {
    listen       80;
    server_name  markdown.localhost;
    root         /path/to/sample-markdown-cms/public;

    location / {
        index index.php;
        try_files $uri $uri/ @php;
    }

    location @php {
        # Pass the PHP requests to FastCGI server (php-fpm) on 127.0.0.1:9000
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_param  SCRIPT_FILENAME /path/to/sample-markdown-cms/public/index.php;
        include fastcgi_params;
    }
}

Restart the nginx, now you should be ready to go!