How to Install Grav CMS on CentOS 7
0

Grav is a fast, simple, and versatile, file-based CMS platform. Grav comes with a robust Package deal Administration System to permit for easy set up and upgrading of plugins and themes, in addition to easy updating of Grav itself.

The underlying structure of Grav is designed to make use of well-established and best-in-class applied sciences to make sure that Grav is straightforward to make use of and simple to increase. A few of these key applied sciences embody:

  • Twig Templating: for highly effective management of the person interface
  • Markdown: for straightforward content material creation
  • YAML: for easy configuration
  • Parsedown: for quick Markdown and Markdown Further help
  • Doctrine Cache: layer for efficiency
  • Pimple Dependency Injection Container: for extensibility and maintainability
  • Symfony Occasion Dispatcher: for plugin occasion dealing with
  • Symfony Console: for CLI interface
  • Gregwar Picture Library: for dynamic picture manipulation

Necessities

Grav is deliberately designed with few necessities. Grav is constructed with plain textual content information to your content material. There is no such thing as a database wanted. 

Make sure that your system meets the next necessities:

  • Web Server (Apache, Nginx, LiteSpeed, Frivolously, IIS, and so forth.) We’ll use NGINX.
  • PHP model 7.1.Three or increased

Stipulations

  • An working system operating CentOS 7.
  • A non-root person with sudo privileges.

Preliminary steps

Examine your CentOS model:

cat /and so forth/centos-release
# CentOS Linux launch 7.6.1810 (Core)

Arrange the timezone:

timedatectl list-timezones
sudo timedatectl set-timezone 'Area/Metropolis'

Replace your working system packages (software program). This is a vital first step as a result of it ensures you’ve the most recent updates and safety fixes to your working system’s default software program packages:

sudo yum replace -y

Set up some important packages which are mandatory for fundamental administration of the CentOS working system:

sudo yum set up -y curl wget vim git unzip socat bash-completion epel-release

Step 1 – Set up PHP and mandatory PHP extensions

Setup the Webtatic YUM repo:

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Set up PHP, in addition to the mandatory PHP extensions:

sudo yum set up -y php72w php72w-cli php72w-fpm php72w-common php72w-curl php72w-gd php72w-json php72w-mbstring php72w-xml php72w-zip php72w-opcache php72w-pecl-apcu

To point out PHP compiled in modules, you may run:

php -m

ctype
curl
exif
fileinfo
. . .
. . .

Examine the PHP model:

php --version# PHP 7.2.17 (cli) (constructed: Could 13 2019 18:03:04) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Applied sciences
# with Zend OPcache v7.2.17, Copyright (c) 1999-2018, by Zend Applied sciences

Begin and allow PHP-FPM service:

sudo systemctl begin php-fpm.service
sudo systemctl allow php-fpm.service

Step 2 – Set up acme.sh shopper and acquire Let’s Encrypt certificates ( non-obligatory )

Securing your discussion board with HTTPS shouldn’t be mandatory, however it’s a good observe to safe your website visitors. With a purpose to acquire TLS certificates from Let’s Encrypt we’ll use acme.sh shopper. Acme.sh is a pure UNIX shell software program for acquiring TLS certificates from Let’s Encrypt with zero dependencies. 

Obtain and set up acme.sh:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh 
./acme.sh --install --accountemail [email protected]
supply ~/.bashrc
cd ~

Examine acme.sh model:

acme.sh --version
# v2.8.0

Acquire RSA and ECC/ECDSA certificates to your area/hostname:

# RSA 2048
acme.sh --issue --standalone -d instance.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d instance.com --keylength ec-256

If you’d like pretend certificates for testing you may add --staging flag to the above instructions.

After operating the above instructions, your certificates and keys will likely be in:

  • For RSA: /dwelling/username/instance.com listing.
  • For ECC/ECDSA: /dwelling/username/instance.com_ecc listing.

To listing your issued certs you may run:

acme.sh --list

Create a listing to retailer your certs. We’ll use /and so forth/letsencrypt listing.

mkdir -p /and so forth/letsecnrypt/instance.com
sudo mkdir -p /and so forth/letsencrypt/instance.com_ecc

Set up/copy certificates to /and so forth/letsencrypt listing.

# RSA
acme.sh --install-cert -d instance.com --cert-file /and so forth/letsencrypt/instance.com/cert.pem --key-file /and so forth/letsencrypt/instance.com/personal.key --fullchain-file /and so forth/letsencrypt/instance.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d instance.com --ecc --cert-file /and so forth/letsencrypt/instance.com_ecc/cert.pem --key-file /and so forth/letsencrypt/instance.com_ecc/personal.key --fullchain-file /and so forth/letsencrypt/instance.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All of the certificates will likely be mechanically renewed each 60 days.

After acquiring certs exit from root person and return again to regular sudo person:

exit

Step 3 – Set up and configure NGINX

Set up NGINX:

sudo yum set up -y nginx

Examine the NGINX model:

nginx -v
# nginx model: nginx/1.12.2

Begin and allow NGINX service:

sudo systemctl begin nginx.service
sudo systemctl allow nginx.service

Configure NGINX for Grav. Run sudo vim /and so forth/nginx/conf.d/grav.conf and add the next configuration.

server {
   
   pay attention 80;
   pay attention 443 ssl;
server_name instance.com; root /var/www/grav;
ssl_certificate /and so forth/letsencrypt/instance.com/fullchain.pem;
ssl_certificate_key /and so forth/letsencrypt/instance.com/personal.key;
ssl_certificate /and so forth/letsencrypt/instance.com_ecc/fullchain.pem;
ssl_certificate_key /and so forth/letsencrypt/instance.com_ecc/personal.key;
index index.html index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~* /(.git|cache|bin|logs|backup|exams)/.*$ { return 403; } location ~* /(system|vendor)/.*.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; } location ~* /person/.*.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; } location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|net.config|htaccess.txt|.htaccess) { return 403; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_index index.php; embody fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; } }

Examine NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 4 – Set up Grav CMS

Create a doc root listing:

sudo mkdir -p /var/www/grav

Change possession of the /var/www/grav listing to johndoe:

sudo chown -R johndoe:johndoe /var/www/grav

Navigate to the doc root folder:

cd /var/www/grav

Obtain and unzip Grav:

wget https://getgrav.org/download/core/grav-admin/1.6.9
unzip 1.6.9
mv grav-admin/* . && mv grav-admin/.* .
rm -rf grav-admin 1.6.9

NOTE: Model 1.6.9 is the present model and could also be totally different by the point you learn this. Please test the Grav web site for the most recent info.

Change possession of the /var/www/grav listing to nginx:

sudo chown -R nginx:nginx /var/www/grav

Run sudo vim /and so forth/php-fpm.d/www.conf and set person and group to nginx. Initially, it is going to be set to person and group apache:

sudo vim /and so forth/php-fpm.d/www.conf
# person = nginx
# group = nginx

Restart the PHP-FPM service.

sudo systemctl restart php-fpm.service

Create /var/lib/php/session/ listing and alter possession to nginx:

sudo mkdir -p /var/lib/php/session/ && sudo chown -R nginx:nginx /var/lib/php/session/

Open http://example.com in your net browser and comply with the on-screen directions. To entry Grav admin append /admin to your URL.

Step 5 – Full Grav setup

Create a Grav admin person:

Add Grav admin user

After the creation, you can be redirected to the admin dashboard:

Grav CMS Dashboard

Hyperlinks

Right here’s what an Apple TV and Alexa appear to be on an outdated TV and file participant cupboard

Previous article

Huawei export ban claims one other sufferer: Huawei’s $2,600 foldable smartphone

Next article

You may also like

Comments

Leave a Reply

More in Apache