This article is outdated and may not work correctly for current operating systems or software.
Grav is a modern flat file CMS that is fast, extensible and open-source. It's easy to use and has a host of impressive plugins, one of which is an admin for it.
Spin up a Ubuntu 14 Vultr instance and run below commands to install some essential utilities, PHP 7, and Nginx. Note: You can put this portion in a startup script and spin up your using it to make the process faster.
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -y
sudo apt-get upgrade -y
# install some essential tools
sudo apt-get install -y acl curl git software-properties-common unzip zip
# install php7
sudo apt-add-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install -y --force-yes php7.0-cli php-curl php-gd php7.0-zip php7.0-mcrypt php-apcu php-xml php-mbstring php-intl
# install nginx
sudo apt-get install -y --force-yes nginx
sudo apt-get install -y --force-yes php7.0-fpm
# tweak php ini file
sudo sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/cli/php.ini
sudo sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
# remove default site setup and restart nginx
rm -f /etc/nginx/sites-enabled/*
rm -f /etc/nginx/sites-available/*
service nginx restart
SSH into your server as root from your terminal.
ssh root@[vultr-instance-ip]
Note: Ideally you will want to secure ssh as prescribed in vultr.com/docs/securing-ssh-on-ubuntu-14-04 on a public facing site
Create a directory to hold grav site
# create directory
mkdir -p /sites/grav && cd /sites/grav
# set permissions
chmod -R 775 /sites
chown -R www-data:www-data /sites
chmod -R g+s /sites
# put temporary index file
echo "<h3>Welcome Home...</h3>" >> index.php
echo "<?php phpinfo();" >> index.php
Setup a nginx host to for the site:
cd
into nginx sites available directory cd /etc/nginx/sites-available/
Create a config file for grav site sudo nano grav
Paste below content into file, then save and exit (Ctrl+X -> Y -> hit Enter)
server {
listen 80;
server_name vultr.dev; #NOTE: vultr.dev should be replaced with your domain name eventually
root /sites/grav;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Enable grav config
sudo ln -s /etc/nginx/sites-available/grav /etc/nginx/sites-enabled/grav
Restart nginx and php-fpm
sudo service nginx restart
sudo service php7.0-fpm restart
Update servers host file sudo bash -c "echo '127.0.0.1 vultr.dev' >> /etc/hosts"
_(Note: vultr.dev should be replaced with your domain name eventually)
You should be able to browse to http://[vultr-instance-ip] and see a "Welcome Home" message along with some info on the version of PHP installed (if you don't see this or are using vultr.dev as used above, you'll have to perform additional step below to add a host entry for vultr.dev on your local machine)
Add below entry to your host file.
[vultr-instace-ip] vultr.dev
Your host file should be located in one of the listed areas below depending on what OS you are running.
Windows - c:\windows\system32\drivers\etc\hosts
Linux - /etc/hosts
Mac - /private/etc/hosts
Install composer and create a grav project.
# install composer
sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# create grav project
cd /sites
mv grav grav-test
composer create-project getgrav/grav
# below is only needed if you logged as sudo
# ideally you should secure ssh as prescribed in vultr.com/docs/securing-ssh-on-ubuntu-14-04
chown -R www-data:www-data /sites
Browse to http://vultr.dev (or your domain) and you should be greeted with a welcome page that says "Grav is Running!".