Getting started

In the following article you will know how to build the project on Vegas Library.

Prepare environment

Install php (at least 5.4 version). Vegas library is based on PHP language.

//Ubuntu 14.04
sudo apt-get install php5
sudo apt-get install php-pear

Install HTTP server. You can choose between Apache and Nginx.

Apache Nginx
//Ubuntu 14.04 (Apache)
sudo apt-get install apache2
//Ubuntu 14.04 (Nginx)
sudo apt-get install nginx

Install git

//Ubuntu 14.04
sudo apt-get install git

Install curl

//Ubuntu 14.04
sudo apt-get install curl

Install phing

//Ubuntu 14.04
sudo pear channel-discover pear.phing.info
sudo pear install phing/phing

Install Phalcon

Install Phalcon Library

//Ubuntu 14.04
sudo apt-get install php5-dev libpcre3-dev gcc make php5-mysql

Download Phalcon

//Ubuntu 14.04
sudo apt-add-repository ppa:phalcon/stable
sudo apt-get update
sudo apt-get install php5-phalcon

If you are missing apt-add-repository run the following command:

//Ubuntu 14.04
sudo apt-get install python-software-properties

Build project

Create your project using vegaser tool

cd /var/www
sudo mkdir vegas-test
sudo chown {your_user}:{your_user} -R vegas-test
cd vegas-test
wget https://github.com/vegas-cmf/vegaser/raw/master/build/vegaser.phar --no-cache
php vegaser.phar build-project

During building project you will see some questions like

...
Enter name of project (eg. vegas-demo): vegas-test
Enter description of project [Project based on Vegas CMF] This is test of vegas project
Enter project domain [vegasdemo.com] vegas-test.local
...

Remember the domain you answer to the question "Enter project domain" because you will need it for virtual host


Install vendors

php composer.phar install

Create virtual host


Virtual Host Apache Virtual Host Nginx

Create virtual host file

//Ubuntu 14.04
cd /etc/apache2/sites-available
sudo vim vegas-test.conf

Set content of the file

<VirtualHost *:80>
    ServerName vegas-test.local
    ServerAlias www.vegas-test.local vegas-test.local
    DocumentRoot /var/www/vegas-test/public

    <Directory /var/www/vegas-test/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Enable virtual host file and enable mod rewrite

sudo a2ensite vegas-test.conf
sudo a2enmod rewrite
sudo service apache2 restart

Install php5-fpm

sudo apt-get install php5-fpm

Create virtual host file

//Ubuntu 14.04
cd /etc/nginx/sites-available/
sudo vim vegas-test.conf

Set content of the file

server {
    listen 80;
    server_name vegas-test.local;

    # Path to the root of your installation
    set $root_path /var/www/vegas-test/public;
    root $root_path;

    access_log /var/log/nginx/vegas-test.local-access.log combined;
    error_log /var/log/nginx/vegas-test.local-error.log error;

    client_max_body_size 32M; # set max upload size
    fastcgi_buffers 64 4K;

    index index.php index.html index.htm;

    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^/(.*)$ /index.php?_url=/$1;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ~ \.php {
        fastcgi_index  /index.php;
        #try_files $1 = 404;

        include fastcgi_params;

        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


        ##fastcgi_pass 127.0.0.1:9000;
        ## Or use unix-socket with 'fastcgi_pass unix:/var/run/php5-fpm.sock;'
        fastcgi_pass unix:/var/run/php5-fpm.sock; #value is copied as described above
    }

    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root $root_path;
    }

    # Optional: set long EXPIRES header on static assets
    location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
        expires 30d;
        # Optional: Don't log access to assets
        access_log off;
    }
}

Enable virtual host file

sudo ln -s /etc/nginx/sites-available/vegas-test.conf /etc/nginx/sites-enabled/vegas-test.conf

Restart nginx

sudo service nginx restart


Add host to /etc/hosts file

sudo vim /etc/hosts

Add the following line to the file

127.0.0.1 www.vegas-test.local vegas-test.local

Run your project in your browser http://vegas-test.local