Fork is an open source CMS written in PHP. Fork's source code is hosted on GitHub. This guide will show you how to install Fork CMS on a fresh Fedora 28 Vultr instance.
.htaccess
, mod rewrite
, mod expires
(optional but recommended) and mod deflate
(optional) enabled.Check the Fedora version.
cat /etc/fedora-release
# Fedora release 28 (Twenty Eight)
Create a new non-root user account with sudo
access and switch to it. Replace johndoe
with your username.
useradd -c "John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe
Set up the timezone.
timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'
Ensure that your system is up to date.
sudo dnf check-upgrade || sudo dnf upgrade -y
Install required and useful packages.
sudo dnf install -y wget vim unzip bash-completion
For simplicity, disable SELinux and Firewall.
sudo setenforce 0
sudo systemctl stop firewalld
sudo systemctl disable firewalld
Download and install PHP and required PHP extensions.
sudo dnf install -y php-cli php-fpm php-common php-mbstring php-gd php-intl php-mysqlnd php-xml php-json
Check the PHP version.
php --version
# PHP 7.2.6 (cli) (built: May 22 2018 16:22:08) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Install Nginx.
sudo dnf install -y nginx
Check the Nginx version.
nginx -v
# nginx version: nginx/1.12.1
Start and enable Nginx.
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
Install MariaDB.
sudo dnf install -y mariadb-server
Check the MariaDB version.
mysql --version
# mysql Ver 15.1 Distrib 10.2.15-MariaDB, for Linux (x86_64) using readline 5.1
Start and enable MariaDB.
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
Run the mysql_secure_installation
script to improve the security of your MariaDB installation.
sudo mysql_secure_installation
Log into MariaDB as the root user.
mysql -u root -p
# Enter password:
Create a new MariaDB database and user, and remember the credentials.
create database dbname;
grant all on dbname.* to 'username' identified by 'password';
Exit MySQL.
exit
Run sudo vi /etc/nginx/conf.d/fork.conf
and populate it with the following.
server {
listen 80;
root /var/www/fork;
index index.php index.html;
server_name example.com;
location / {
# Checks whether the requested url exists as a file $uri or directory $uri/ in the root, else redirect to /index.php.
try_files $uri $uri/ @redirects;
}
location @redirects {
rewrite ^ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock; # Make sure to doublecheck this!
fastcgi_index index.php;
fastcgi_read_timeout 60;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Don't pollute the logs with common requests
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
# As Fork CMS has the app_root as doc_root, we need to restrict access to a few things for security purposes!
location ~* ^/(composer\..*|vendor\/.*|Procfile$|\.git\/.*|src\/Console.*|.*\.gitignore|\.editorconfig|\.travis.yml|autoload\.php|bower\.json|phpunit\.xml\.dist|.*\.md|app\/logs\/.*|app\/config\/.*|src\/Frontend\/Cache\/CompiledTemplates.*|src\/Frontend\/Cache\/Locale\/.*\.php|src\/Frontend\/Cache\/Navigation\/.*\.php|src\/Frontend\/Cache\/Search\/.*|src\/Backend\/Cache\/CompiledTemplates\/.*|src\/Backend\/Cache\/Locale\/.*\.php)$ {
deny all;
access_log off;
log_not_found off;
}
# Deny access to dot-files.
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
A summary of the changes that you will be making are as follows.
root
directive to point to the correct location of your website, such as /var/www/fork
.server_name
directive to point to your domain name or IP address.fastcgi_pass
is set correctly.Test the Nginx configuration.
sudo nginx -t
Reload Nginx.
sudo systemctl reload nginx.service
Download Composer dependencies.
sudo dnf install -y curl git unzip
Download and install Composer, the dependency manager for PHP.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
Check the Composer version.
composer --version
# Composer version 1.6.5 2018-05-04 11:44:59
Create a document root directory.
sudo mkdir -p /var/www/fork
Change ownership of the /var/www/fork
directory to johndoe
.
sudo chown -R johndoe:johndoe /var/www/fork
Download the latest stable release of Fork CMS from the command line.
cd /var/www/fork
composer create-project forkcms/forkcms .
Change ownership of the /var/www/fork
directory to nginx
.
sudo chown -R nginx:nginx /var/www/fork
Run sudo vim /etc/php-fpm.d/www.conf
and set user and group to nginx
.
sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx
Restart php-fpm.service
.
sudo systemctl restart php-fpm.service
Edit the app/config/parameters.yml.dist
file and set database information.
sudo vim /var/www/fork/app/config/parameters_install.yml
Create /var/lib/php/session
directory and change its ownership to user nginx
.
sudo mkdir -p /var/lib/php/session
sudo chown -R nginx:nginx /var/lib/php/session
Finally, using your preferred web browser, open your site and follow the Fork CMS
installer. After following the installer, you will have a Fork instance up and running. To access the Fork admin area just append /private
to your site URL.
You could earn up to $300 by adding new articles