First of all this is a quick tutorial to install flarum, with no advanced settings...
1. Installing Nginx
Run this commands:
yum install epel-release -y
yum install nginx -y
systemctl start nginx
systemctl enable nginx
2. Installing MariaDB
Run this commands:
yum install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
When you finish install, run this command to change root password:
mysql_secure_installation
3. Installing Php 7
Run this commands:
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
yum install yum-utils -y
yum-config-manager --enable remi-php71
yum --enablerepo=remi,remi-php71 install php-fpm php-common
yum --enablerepo=remi,remi-php71 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
4. Configuring firewall
Run this commands:
yum firewall-cmd --zone=public --permanent --add-service=http
yum firewall-cmd --zone=public --permanent --add-service=mysql
yum firewall-cmd --zone=public --add-port=3306/tcp (only to make sure mysql port is open)
firewall-cmd --reload
5. Configuring Flarum to nginx
Create nginx configuration for flarum in:
/etc/nginx/conf.d/
Example:
/etc/nginx/conf.d/myflarum.conf
And put this code:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
# note that these lines are originally from the "location /" block
root /usr/share/nginx/YOURFOLDERSITE;
index index.php index.html index.htm;
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
location /flarum {
deny all;
return 404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 1M;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
application/javascript
application/json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
#text/html -- text/html is gzipped by default by nginx
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
}
When done, just execute:
systemctl restart nginx
6. Configuring Php-fpm to work in nginx
Go to:
/etc/php-fpm.d/www.conf
You will need replace these lines:
user = apache to user = nginx
group = apache to group = nginx
listen.owner = nobody to listen.owner = nginx
listen.group = nobody to listen.group = nginx
Finally check if ;listen = 127.0.0.1:9000 is without ;
When you finish:
systemctl start php-fpm.service
systemctl enable php-fpm.service
7. Installing composer
cd /tmp
sudo curl -sS https://getcomposer.org/installer | php
And for finish
mv composer.phar /usr/local/bin/composer
8. Installing FLARUM
Go to
cd /usr/share/nginx/YOURFOLDER
And use:
composer create-project flarum/flarum . --stability=beta
8. Correct Permissions
chown -R nginx: /usr/share/nginx/YOURFOLDER
chown -R nginx: /var/lib/php
9. Creating one database for flarum
First:
mysql -u root -p
and enter your password.
When logged:
CREATE DATABASE yourfarumDB;
you can put anything.
10. Now you can start install flarum
Enter in your domain, put the correct settings of mysql and BE HAPPY! ?
Remembering, this tutorial was made for beginners and it is a quick tutorial, without much explanation, if some step was left aside, please speak in the comments and I will add the discussion.