Please excuse, this is a work in progress tutorial. Using it as a place to store notes until I can compile to a tutorial.
Please do not follow steps until I remove the WIP from the title.
Motivation:
It would be cool for folks with limited web development experience to have a tutorial for setting up a quasi "full featured" website that includes Blog and Forum. Ultimately this tutorial will be about how to install Flarum side by side with a Laravel app. Currently its to help me not have to fumble with commands used and then have to relearn them every time I rebuild.
Goals:
Have a blog/cms platform with Flarum integration. (well as best as possible)
If possible, have Flarum use Coaster CMS authentication and/or have Coaster CMS use Flarum authentication.
If possible, theme Coaster to share Flarum headers / color style.
Research:
After days of google searching for "Laravel CMS" "Laravel Blog" and days of git cloning various repos/boilerplates, installing and testing features and overall customization's, Coaster CMS was the platform I felt would be best.
Ref: http://www.tldevtech.com/laravel-cms-packages/
What is Coaster CMS:
https://www.coastercms.org/about-coaster-cms
Features:
Built with Laravel 5 (v5.4)
Responsive file manager
WYSIWYG editor
Block based templating system
Beacon support
Its pretty awesome, the admin side especially.
Installation Gotchas:
I tried multiple times to get it to install in flarum-root/cms and although the install worked there were issues with some of the platform plugins that were looking for the /cache dir and /upload dir in the web-root folder as apposed to the /cms/cache dir.
Im sure there is a rewrite hack to fix that or maybe the use of symbolic links but after the 10th time reinstalling I began thinking it would be easier to have Coaster CMS be the root folder and host Flarum in a subfolder.
Installation assumptions:
You have a host (ubuntu/debian) to ssh to that has at least 1gb memory.
You already have a Flarum site and want to add a blog/cms
You don't have a site yet and want a blog/cms + forum site
Installation:
Currently reproducing steps needed.
Please stand by
Install Flarum and everything else needed first:
wget https://raw.githubusercontent.com/webeindustry/flarumvpsinstallscript/patch-1/script
chmod +x script
sudo ./script
Install Script Notes:
First question the script asks is for your domain name. If you do not already have a domain name that points to your host (ex: mysite.org) or you are using something like a AWS EC2 instance, put your sites IP# as the domain name.
Second thing it asks you is to create a root MYSQL password. Make sure its atleast 8 chars and uses a combo of upper + lower or upper + special char. (This password will also be used to install phpmyadmin)
When the script finishes, you should see:
Flarum username -> flarum_3421####
Flarum database -> flarum_3421####
Flarum database password -> iries0Eish5uph#####
Next step is to open your web browser to your domain name or IP# of the host.
You should see:
Fill out the fields using the Flarum info provided at the end of the script.
Example:
MYSQL Host: localhost
MYSQL Database: flarum_3421####
MYSQL Username: flarum_3421####
MYSQL Password: iries0Eish5uph#####
Table Prefix: (I dunno what this is for, I leave it blank)
Admin Username: Admin
Admin Email: myownpersonalemail@nunyabiz.com
Admin Password: mycreativepassword
Confirm Password: mycreativepassword
Click on the button and congratulations, you have a working stock Flarum forum.
Now we need to copy our Flarum install to separate directory,
then remove our webroot dir,
then install PHP ZipArchive;
then use composer to install Coaster CMS to the webroot dir we just removed,
and then move our Flarum installation directory to a sub-directory of our webroot.
For this tutorial, my flarum install dir (webroot folder) is /var/www/34.213.8.82/
Yours might be /var/www/mysitename
cd /var/www/
sudo mkdir -p forum
sudo cp -r 34.213.8.82/. forum/
sudo rm -rf 34.213.8.82
sudo apt-get install php7.0-zip
sudo composer create-project web-feet/coastercms 34.213.8.82
sudo mv forum/ 34.213.8.82/public/
Successful composer install output in terminal:
Now we need to set appropriate file permissions to install Coaster:
cd /var/www/34.213.8.82
sudo chgrp -R www-data storage bootstrap/cache public/uploads public/cache public/coaster public/themes resources .env
sudo chmod -R ug+rwx storage bootstrap/cache public/uploads public/cache public/coaster public/themes resources .env
Next lets install Phpmyadmin.
sudo apt-get install phpmyadmin
Do not select either Apache or Light, just press [Enter]
Accept default security
Enter the mysql password you created during Flarum install script.
Next we need to reconfigure our Nginx / Sites-enabled config.
To do that:
sudo nano /etc/nginx/sites-enabled/34.213.8.82
Replace 34.213.8.82 with the name of your site.
Remove the entire contents of the file by pressing CTRL-K until all lines have been removed.
Copy code below and Paste (CTRL-Insert) inside file:
Make sure to replace 34.213.8.82 with your site in both root
and servername
If you decided to call your flarum folder something different than /forum
you will also need to replace all folder names with /forum
to your folder name.
Save and exit when finished.
server {
listen 80;
root /var/www/34.213.8.82/public;
index index.php index.html index.htm;
rewrite ^/index.php/(.*) /$1 permanent;
server_name 34.213.8.82;
location / {
index index.html index.php;
try_files $uri $uri/ /index.php$is_args$args;
}
location /forum {
try_files $uri $uri/ /forum/index.php?$args;
location /forum { try_files $uri $uri/ /forum/index.php?$query_string; }
location /forum/api { try_files $uri $uri/ /forum/api.php?$query_string; }
location /forum/admin { try_files $uri $uri/ /forum/admin.php?$query_string; }
}
location /forum/flarum {
deny all;
return 404;
}
location ~* \.php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
fastcgi_index index.php;
}
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)";
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location ~ /\. {
deny all;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Now open a web browser to yoursite/phpmyadmin
Login with root, the MYSQL password you created when you installed Flarum.
You should see something like this when you login:
On the left, click on "New"
Enter a name for your Coaster CMS database. Then click on "Create":
Thats all we need phpmyadmin for.
To finish installing Coaster CMS we need to open the browser to our site/install.
For this demonstration, the site would be 34.213.8.82/install
You should see:
If you see "No" on any of those, then there is an issue with your file permissions.
You will need to troubleshoot that before continuing.
Click on 'Continue'
On the next page we input our details:
I put in the root login for MYSQL that was created during the Flarum install.
I put in the name of the CoasterCMS database I created in Phpmyadmin
Then click on "Run Database Setup"
Next we create our Admin account: (self explanatory)
Then we select our theme: (if you DONT want per-populated demo data, uncheck the box.)
Click on 'Complete Install'
Coaster CMS Themes
coaster2016:
coaster2017:
Coaster CMS has been installed, you can no check out the Admin Dashboard and the Frontend page.
Screenshot of Admin Dash:
Still having issues, tutorial not complete
Issue reported here:
Web-Feet/coastercms58