Install Vanilla forums

Note: This article has had no material updates since November 30, 2014 and is not currently being maintained. Vanilla forums have had several updates since then, so this article should be used for reference purposes only.

Vanilla forums software is a popular forum software that includes many advanced features not found in other forum software, including automatic draft saving, active notifications of messages and discussion responses, and an overall clean look. This article covers installing Vanilla Forums to a LEMP web server set up according this site's series of articles, which can be reviewed in the Steps to create a UNPM Server.

vanilla.conf
username@servername:~$ sudo nano /etc/nginx/package-configs/vanilla.conf

Paste into the file, with  being the site's root subdirectory Vanilla will be installed to:

location = /forums/index.php { include global-configs/php.conf; fastcgi_split_path_info ^(.+\.php)(.*)$; } location /forums/ { location ~* /categories/[0-9]*(/.*)?$ { return 404; } location ~* ^/uploads/.*.(html|htm|shtml|php|js)$ { types { } default_type text/plain; }    try_files $uri $uri/ @forum; location ~ \.php$ { deny all; } } location @forum { rewrite ^/forums/(.+)$ /forums/index.php?p=$1 last; }

vanilla_https.conf
username@servername:~$ sudo nano /etc/nginx/package-configs/vanilla_https.conf

Paste into the file, with  being the site's root subdirectory Vanilla will be installed to:

location = /forums/index.php { include global-configs/php_https.conf; fastcgi_split_path_info ^(.+\.php)(.*)$; } location /forums/ { location ~* /categories/[0-9]*(/.*)?$ { return 404; } location ~* ^/uploads/.*.(html|htm|shtml|php|js)$ { types { } default_type text/plain; }    try_files $uri $uri/ @forum; location ~ \.php$ { deny all; } } location @forum { rewrite ^/forums/(.+)$ /forums/index.php?p=$1 last; }

Edit sites-available file
Open the sites-available file for the domain:

username@servername:~$ sudo nano /etc/nginx/sites-available/example.com

In the HTTP server block, add:

include package-configs/vanilla.conf;

In the HTTPS server block, add:

include package-configs/vanilla_https.conf;

Test and Restart nginx
Test and reload nginx.

username@servername:~$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful username@servername:~$ sudo service nginx reload * Reloading nginx configuration nginx                                  [ OK ]

Create Vanilla database and database user
Create a Vanilla database and database user:

username@servername:~$ sudo mysql -uroot -p MariaDB [(none)]> create database databasename default character set utf8 default collate utf8_general_ci; MariaDB [(none)]> grant all on databasename.* to 'databasenameusername'@'localhost' identified by 'databasenameusernamepassword'; MariaDB [(none)]> exit

Note that the,   and   will be required for the Vanilla installation process.

Vanilla Forums package installation
This install is for Vanilla Forums 2.1.6.

username@servername:~$ wget https://open.vanillaforums.com/get/vanilla-core-3.1.zip username@servername:~$ unzip -d /var/www/example.com/public vanilla-core-2.1.6.zip username@servername:~$ mv /var/www/example.com/public/vanilla/ /var/www/example.com/public/forums username@servername:~$ find /var/www/example.com/public/forums -type d | xargs chmod 775 username@servername:~$ find /var/www/example.com/public/forums -type f | xargs chmod 664 username@servername:~$ chmod -R 777 /var/www/example.com/public/forums/{conf,uploads,cache} username@servername:~$ sudo chown -R www-data:www-data /var/www/example.com/public/forums

Navigate to the secure  https://www.example.com/forums/  and complete the Vanilla Forums online installation.

Note that the  permissions are required by Vanilla, so complain to them about this.

Configure Vanilla Forums
In addition to the configurations available from the default plugins located in the Vanilla forums dashboard, plugins may be added to the  directory then enabled in the dashboard and configurations may be set in the   file.

Themes
It is strongly recommended that admins using the default theme create a clone of the default and use that instead. Otherwise all customizations made to the default theme may be lost during an update.

username@servername:~$ cp -r /var/www/example.com/public/forums/themes/default/ /var/www/example.com/public/forums/themes/defaultclone/ username@servername:~$ nano /var/www/example.com/public/forums/themes/defaultclone/about.php

In the line  change   to the desired name.

In the line  change   to the desired name. This will be displayed in the dashboard as the name of the theme.

The  line is displayed in the dashboard to describe the theme. The  can be replaced with   around text that will be displayed as the version - be sure to leave the   at the end of the line. ,  and   may also be changed as desired.

username@servername:~$ mkdir /var/www/example.com/public/forums/themes/defaultclone/views username@servername:~$ touch /var/www/example.com/public/forums/themes/defaultclone/design/custom.css username@servername:~$ cp /var/www/example.com/public/forums/applications/dashboard/views/default.master.tpl /var/www/example.com/public/forums/themes/defaultclone/views/default.master.tpl username@servername:~$ sudo chown -R www-data /var/www/example.com/public/forums/themes/defaultclone/

The new theme should now be an option in the dashboard's themes menu.

Configuration settings in config.php
To use the following configurations, open  for editing:

username@servername:~$ nano /var/www/example.com/public/forums/conf/config.php

Load local fonts and jQuery scripts
The default configuration for Vanilla makes use of Google APIs for loading jQuery scripts as well as some fonts, which will use fewer resources and may load faster than when locally stored. The tradeoff being that Google can track users who use the site by recording the header information sent when requesting the scripts and fonts. To force locally stored scripts and fonts to load, edit the following line:

$Configuration['Garden']['Cdns']['Disable'] = TRUE;

Combine CSS files
CSS files may be combined for faster page loading. Note this is an experimental feature which may cause issues for some setups. Add the following line:

$Configuration['Garden']['CombineAssets'] = TRUE;

Change input method
The input method can be specified by adding a line then specifying the desired method. If not present, add the following line:

$Configuration['Garden']['InputFormatter'] = 'Markdown';

The above configuration sets markdown as the input type. Input type options are case sensitive:,  ,  or.

Enable debug
This will display messages at the bottom of each page that may be useful for troubleshooting. It is different from the Debugger plugin.

$Configuration['Debug'] = TRUE;

Note that when disabling the plugin it easier to change  to   so that when Vanilla overwrites the config file for a settings change made via the dashboard the line will not be deleted, allowing for convenient enabling in the future.

Plugins
The default set of plugins are fairly straightforward. Note that when enabling the WYSIWYG editor, the editor defaults to this mode and some features may not be available without selecting the text button. There are also a lot of great plugins found at the Vanilla forums website.

Enable Debugger
If the forum is not responding as expected, the debug mode may be enabled for troubleshooting by enabling the Debugger plugin. This mode will display information and error statements at the bottom of every page.

Add quote option for comments
The Quotes plugin adds a quote option to more easily quote posts:

username@servername:~$ wget http://vanillaforums.org/get/quotes-plugin-1.6.9.zip username@servername:~$ unzip -d /var/www/example.com/public/forums/plugins quotes-plugin-1.6.9.zip username@servername:~$ find /var/www/example.com/public/forums/plugins/Quotes/ -type f | xargs chmod 664 username@servername:~$ find /var/www/example.com/public/forums/plugins/Quotes/ -type d | xargs chmod 775 username@servername:~$ sudo chown -R www-data:www-data /var/www/example.com/public/forums/plugins/Quotes username@servername:~$ rm quotes-plugin-1.6.9.zip

The Quotes plugin should now be an option in the dashboard.

Piwik plugin
For servers with Piwik installed, the Piwik Analytics plugin can be used to enable Piwik across the forum. To install, download and extract the plugin to the  directory. It is also advisable to make a few changes to some of the files to prevent popular tracker blockers from preventing the code from being loaded.

username@servername:~$ wget http://vanillaforums.org/get/piwik-plugin-2.6.5.zip username@servername:~$ unzip -d /var/www/example.com/public/forums/plugins piwik-plugin-2.6.5.zip username@servername:~$ sudo chown -R www-data /var/www/example.com/public/forums/plugins/Piwik/ username@servername:~$ rm piwik-plugin-2.6.5.zip username@servername:~$ nano /var/www/example.com/public/forums/plugins/Piwik/class.piwik.plugin.php

Change the following lines:

 var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function {    var u="$PiwikInstall";     _paq.push(['setTrackerUrl', u+'js/']);     _paq.push(['setSiteId', '$PiwikSiteID']);     var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];     g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'js/'; s.parentNode.insertBefore(g,s);   }); 

For an explanation of, see the Piwik article.

In the Vanilla Forums dashboard, navigate to Addons -> Plugins and enable Piwik Analytics. In the plugin's settings, set PiwikInstall to //www.example.com/randomsymlinkname/ (again, see the Piwik article for an explanation of randomsymlinkname) and set PiwikSiteID to the Id of the website.

Making nice code blocks with PrettyPrint
If the forum being made is expected to make regular use of code blocks, users may not like the default code blocks created by Vanilla. The PrettyPrint plugin can be installed and configured to greatly enhance the forum's code blocks.

username@servername:~$ wget http://vanillaforums.org/get/prettyprint-plugin-1.2.zip username@servername:~$ unzip -d /var/www/example.com/public/forums/plugins prettyprint-plugin-1.2.zip username@servername:~$ find /var/www/example.com/public/forums/plugins/PrettyPrint -type f | xargs chmod 664 username@servername:~$ find /var/www/example.com/public/forums/plugins/PrettyPrint -type d | xargs chmod 775 username@servername:~$ sudo chown -R www-data:www-data /var/www/example.com/public/forums/plugins/PrettyPrint username@servername:~$ rm prettyprint-plugin-1.2.zip username@servername:~$ mv /var/www/example.com/public/forums/plugins/PrettyPrint/prettify/prettify.css /var/www/example.com/public/forums/plugins/PrettyPrint/prettify/original.prettify.css username@servername:~$ nano /var/www/example.com/public/forums/plugins/PrettyPrint/prettify/prettify.css

Paste into the new file:

/* Pretty printing styles. Used with prettify.js. */ pre, code { background-color: #fafafa; border-color: #aaa; } pre code { background-color: transparent; } /* SPAN elements with the classes below are added by prettyprint. */ .pln { color: #000 } /* plain text */ .str { color: #080 } /* string content */ .kwd { color: #00d } /* a keyword */ .com { color: #800 } /* a comment */ .typ { color: #606 } /* a type name */ .lit { color: #066 } /* a literal value */ /* punctuation, lisp open bracket, lisp close bracket */ .pun, .opn, .clo { color: #660 } .tag { color: #00d } /* a markup tag name */ .atn { color: #606 } /* a markup attribute name */ .atv { color: #080 } /* a markup attribute value */ .dec, .var { color: #606 } /* a declaration; a variable name */ .fun { color: red } /* a function name */ /* Use higher contrast and text-weight for printable form. */ @media print, projection { .str { color: #060; } .kwd { color: #006; font-weight: bold; } .com { color: #600; font-style: italic; } .typ { color: #404; font-weight: bold; } .lit { color: #044; } .pun, .opn, .clo { color: #440; } .tag { color: #006; font-weight: bold; } .atn { color: #404; } .atv { color: #060; } } /* Specify class=linenums on a pre to get line numbering */ ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */ li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 { list-style-type: none } /* Alternate shading for lines */ li.L1, li.L3, li.L5, li.L7, li.L9 { background: #f0f0f0 }

To make in-line code a lighter shaded background:

username@servername:~$ nano /var/www/example.com/public/forums/plugins/PrettyPrint/default.php

Remove the following code:

{background-color:#ddd !important}