How to Install Simple Machines 2 Forum Software on a Debian VPS with Nginx

smf2 vpsSimple Machines forum is one of the best open source forum platforms available on the Internet powered by PHP and MySQL.

In this step-by-step tutorial, we will show you how to easily install Simple Machines 2 forum on your Debian based virtual server.


At the time of writing this tutorial, the latest stable version is Simple Machines 2.0.7 and it requires:

  •     PHP 5.2 or higher (the php5-fpm package is required for Nginx servers) with BCMath and GD Graphics Library 2.0 or higher enabled. Also, file_uploads option should be enabled and safe mode, register globals and magic quotes settings should be disabled;
  •     MySQL 5.0 or higher installed on your Linux virtual server.

If you have Apache installed on your server, stop the Apache service and remove Apache packages:

/etc/init.d/apache2 stop
apt-get remove apache2*

In order to install Nginx, PHP-FPM and MySQL on your Debian VPS, execute the following command:

apt-get install nginx php5-fpm php5-cli php5-mysql php5-mcrypt php5-gd mysql-client-5.5 mysql-server-5.5 mysql-server-core-5.5

Download Simple Machines 2 available at to the server and extract it using the following commands:

cd /root
mkdir -p /var/www/{,}
tar -xvf smf_2-0-7_install.tar.bz2 -C /var/www/

Create a new MySQL database for Simple Machines on your server:

mysql -u root -p
mysql> CREATE DATABASE smf2db;
mysql> GRANT ALL PRIVILEGES ON smf2db.* TO 'smf2user'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION;
mysql> quit

Locate the PHP configuration file using the following command:

php5-fpm -i | grep php.ini
Configuration File (php.ini) Path => /etc/php5/fpm
Loaded Configuration File => /etc/php5/fpm/php.ini

Edit the /etc/php5/fpm/php.ini configuration file using the following command:

vi /etc/php5/fpm/php.ini

and add/modify the following lines:

memory_limit = 128M
cgi.fix_pathinfo = 0
file_uploads = On
max_input_time = 60
max_execution_time = 60
register_globals = Off
safe_mode = Off
session.use_trans_sid = 0
magic_quotes_sybase = Off

Execute the following command:

/etc/init.d/php5-fpm restart

Create a new Nginx configuration file:

vi /etc/nginx/sites-available/

and add the following lines:

server {
listen 80;
root /var/www/;
index index.php index.html;
access_log /var/log/nginx/;
error_log /var/log/nginx/;
location ~ \.php {
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Create a symbolic link using the following command:

Need a fast and easy fix?
Unlimited Managed Support
Supports Your Software
2 CPU Cores
50 GB PCIe4 NVMe Disk
1854 GeekBench Score
Unmetered Data Transfer

Now just $43 .99


ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

and restart the Nginx web server for the changes to take effect:

/etc/init.d/nginx restart

The webserver user (www-data) needs to be able to write to ‘attachments’, ‘avatars’, ‘cache’, ‘Packages’, ‘installed.list’, ‘Smileys’ and ‘Themes’ directories and ‘agreement.txt’, ‘Settings.php’, ‘Settings_bak.php’ files so you can easily accomplish that by executing the following command:

chown www-data:www-data -R /var/www/

Open in your favorite web browser and follow the easy instructions. Once the installation is complete, it is recommended to delete the ‘install.php’ script from your server:

rm -rf /var/www/


If you want to to customize the look and feel of your forum there are many themes available for download at . Also, there are various mods available at , such as ‘SMF Secure Login’, ‘Advanced Visual Verification’, ‘BotScout’, ‘Delete Spam Posts’ etc.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Simple Machines 2 forum software for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


2 thoughts on “How to Install Simple Machines 2 Forum Software on a Debian VPS with Nginx”

  1. Just one little thing missing from your otherwise excellent instructions… you need to add “php5-mysql” to the list of apt-get packages. (verified on a nearly 100% vanilla Ubuntu 14.04 install). Otherwise, nice writeup. I like following instructions with the same “get in. get out.” mentality. These were perfect.



Leave a Comment

To prove you are human please solve the following *