How to install your own StatusNet instance with PHP-FPM and Nginx

Jean Baptiste FAVRE

2011 July

La version Française est disponible ici: Installer sa propre instance StatusNet avec PHP-FPM et Nginx

Previously, about StatusNet

In fact nothing: this is the first part. The publication's list will be updated after each new release:

I'll use a reference configruation detailled here:

Anyway, you should be able to use all purely StatusNet related configuration, whatever you web server could be.


StatusNet is a free micro-blogging software, developed with PHP, using MySQL for persistent storage. It's also able to use NoSQL technologies such as memcached to incerase performances. Many plugins can also be used for performances or features.

StatusNet rely on open protocols like oStatus and oAuth.

The main platform operating StatusNet is with about 450.000 users. A new platform, cloud based, is about to open: Both are operated by StatusNet, tha company who writes the software.

One of the main StatusNet's pros concerns reliability. As distributed system, StatusNet does not suffer the famous Twitter "Fail Whale effect". Of course, it can fail and basically it already had. But, when a StatusNet instance fails, the only impacted user are those who registered this instance. Other are not impacted. More, with your own instance, you still control your data.

We are going to install a single StatusNet instance with Nginx and PHP-FPM. I assume you have a commandline access to the server. Anyway, I do not recommend using StatusNet on shared hosting.

Using command line will simplify NGinx configuration.

Before diving into technical stuff

StatusNet has some usefull options. Among them, you will find the "SingleUser" mode. Before starting, just ask you the question: will you be the only user of this instance ? If yes, you can go. If not, or if you're not sure, do not use this mode.

In theory, you can switch between SingleUser and normal mode. In pratice, it's better not to do it because oStatus seems to have some side effects propagating changes, when done.


Based on the configuration described above, we will setup an application pool. That means StatusNet will be available for different domains and, of course, many users.

Firts create directory tree:

Create application environment
mkdir -p /var/www/apps/statusnet/{config,docroot,logs,private,tmp} 
addgroup --system --gid 10001 statusnet 
adduser --home /var/www/apps/statusnet --shel /bin/false --no-create-home \
     --uid 10001 --gid 10001 --disabled-password --disabled-login statusnet 
chmod 7777 /var/www/apps/statusnet/tmp 
chown statusnet: /var/www/apps/statusnet/private 
chmod -R u=rwX,g=rX,o= /var/www/apps/statusnet/private

Then, prepare PHP-FPM configuration.

PHP-FPM setup

cat /var/www/apps/statusnet/config/fpm-pool.conf
    listen                 =
    listen.backlog         = -1
    listen.allowed_clients =
    listen.owner           = statusnet           = statusnet
    listen.mode            = 0666
    user  = statusnet
    group = statusnet
    pm                   = dynamic
    pm.max_requests      = 0
    pm.max_children      = 10
    pm.start_servers     = 5
    pm.min_spare_servers = 5
    pm.max_spare_servers = 5
    pm.status_path       = /php_pool_statusnet_status
    ping.path     = /statusnet_ping
    ping.response =  statusnet_pong
    request_terminate_timeout = 5
    request_slowlog_timeout   = 2
    slowlog                   = /var/www/apps/statusnet/logs/php-slow.log
    ;rlimit_files = 1024
    ;rlimit_core = 0
    ;chroot = /var/www/apps/statusnet/
    ;chdir = /docroot/
    catch_workers_output = yes
    env[TMP]      = /tmp
    env[TMPDIR]   = /tmp
    env[TEMP]     = /tmp
    ;   php_value/php_flag             - you can set classic ini defines which can
    ;                                    be overwritten from PHP call 'ini_set'. 
    ;   php_admin_value/php_admin_flag - these directives won't be overwritten by
    ;                                     PHP call 'ini_set'
    php_flag[display_errors]       = off
    php_admin_value[error_log]     = /var/www/apps/statusnet/logs/php_err.log
    php_admin_flag[log_errors]     = on
    php_admin_value[memory_limit]  = 32M

You'll also need some PHP extension to make StatusNet working.

PHP extensions installation
aptitude install php5-curl php5-gd php5-mysql

Here we are with PHP. It's now time to configure NGinx.

NGinx configuration as application pool

Here, we're going to setup an application pool, as described in my previous publications.

cat /home/hosting/www/apps/status/config/nginx.conf
location ~* ^/status(.*)\.(ico|css|js|gif|png|jpg|bmp|JPG)$ {
    root /home/hosting/www/apps/status/docroot;
    rewrite ^/[^/]+/(.*)$ /$1 break;
    access_log off;
    expires max;
location /status {
        root /home/hosting/www/apps/status/docroot;
        rewrite ^/[^/]+/(.*)$ /index.php/$1 break;

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_connect_timeout          15;
        fastcgi_send_timeout             15;
        fastcgi_read_timeout             15;
        fastcgi_buffer_size              128k;
        fastcgi_buffers                4 256k;
        fastcgi_busy_buffers_size        256k;
        fastcgi_temp_file_write_size     256k;

        fastcgi_index  index.php;
        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx;
        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
        fastcgi_param  REQUEST_URI        $request_uri;
        fastcgi_param  DOCUMENT_URI       $document_uri;
        fastcgi_param  DOCUMENT_ROOT      $document_root;
        fastcgi_param  SERVER_PROTOCOL    $server_protocol;
        fastcgi_param  SERVER_ADDR        $server_addr;
        fastcgi_param  SERVER_PORT        $server_port;
        fastcgi_param  SERVER_NAME        $server_name;
        fastcgi_param  REMOTE_ADDR        $remote_addr;
        fastcgi_param  REMOTE_PORT        $remote_port;
        fastcgi_param  PATH_INFO          $fastcgi_path_info;


If requested file is static and its extension listed, it'll be served from first location block. If not, we assume that it's some FancyURL and pass it to PHP via second location block.

Downside with this setup is that you won't be able to use web based installer, because it'll never be transfered to PHP for execution (since we rewrite all requests to /index.php/$uri. That's why we'll use commandline to install it. The pro here is it also prevents direct call to sensitive files like config.php with is always good for security.

Since StatusNet entry point is always index.php and since we can use command line to install our instance, it's not really a problem not being able to use web installer.

MySQL setup

Finally, prepare MySQL storage:

MySQL databse and user creation
mysql -uroot -p -Be "create database statusnet;"
mysql -uroot -p -Be "grant all on statusnet.* to 'statusnet'@'localhost' identified by 'statusnet_password';"

Keep these informations somewhere, you will need them soon.

StatusNet installation

You just need to grab source package from website and deploy it on you server.

StatusNet installation
cd /tmp/ 
wget // 
tar xzf statusnet-0.9.7fix1.tar.gz
mv statusnet-0.9.7fix1/* /var/www/apps/statusnet/docroot/
rm -rf statusnet-0.9.7fix1.tar.gz statusnet-0.9.7fix1 
cd /var/www/apps/statusnet/docroot/
chown -R root:statusnet .
chmod -R ug=rwX,o=rX avatar background file

Last command is important: StatusNet needs write access in these directories. They are used to store some user data.

StatusNet initialisation

It's now time to create you instance:

StatusNet instance setup
cd /var/www/apps/statusnet/docroot/scripts
php install_cli.php \
	-sstatus.domain.tld \
	--server='status.domain.tld' \
	--sitename="Yet another StatusNet instance"  \
	--fancy='yes'  \
	--dbtype='mysql'  \
	--host='localhost'  \
	--database='statusnet'  \
	--username='statusnet'  \
	--password='statusnet_password'  \
	--admin-nick='your_nickname'  \
	--admin-pass='your_password'  \
	--admin-email='your_email@domain.tld'  \
Starting installation...
Checking database...
Changing to database...
Running database script...
Adding SMS carrier data to database...
Adding notice source data to database...
Adding foreign service data to database...
Writing config file...
An initial user with the administrator role has been created.
StatusNet has been installed at //status.domain.tld/
DONE! You can visit your new StatusNet site (login as 'your_nickname'). If this is your first StatusNet install, you may want to poke around our Getting Started guide.

Simple, yet powerfull. Of course, you have to replace strong strings with you informations.

Now you can join StatusNet network. You can register other people, for example from Of course, you can communicate you StatusNet ID so that people can subscribe you. Just use either StatusNet ID your_nickname@status.domain.tld or URL: //status.domain.tld/your_nickname.

SingleUser mode setup

Remember introduction ? If you still plan to be the only user of your instance, lets add some lines lines into StatusNet configuration file:

cat /var/www/apps/statusnet/docroot/config.php
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }

$config['site']['name'] = 'Yet another StatusNet instance';

$config['site']['server'] = 'status.domain.tld';
$config['site']['path'] = NULL; 

$config['site']['fancy'] = true;

$config['db']['database'] = 'mysqli://statusnet:statusnet_password@localhost/statusnet';

$config['db']['type'] = 'mysql';

$config['singleuser']['enabled'] = true;
$config['singleuser']['nickname'] = 'your_nickname';

Once it's done, you still need to update already created profiles. To do that, you can manually update them directly in database or, better, just use the script:

Update all profiles after a configuration change
php /var/www/apps/statusnet/docroot/scripts/updateprofileurl.php -a

With that configuration, your StatusNet ID is still your_nickname@status.domain.tld but the URL is much more simpler: //status.domain.tld/.

Next time, we'll see how to increase StatusNet performances, how to secure it as well and how to connect it with Twitter and some other cool things.

Stay tuned and have fun !

Sources and references


  • //
  • //
  • //
Getting started
  • //
  • //


Official website
  • //
  • ////


Official website
  • //
  • //

About Jean Baptiste FAVRE

I spend most of my free time on the Internet working on GNU/Linux with Debian or CentOS, virtualization with Xen and KVM technology, as well as cluster stacks with corosync and OpenAIS. Particularly interested in Linux, Netfilter, virtualization, monitoring and clusters, most of my personal works are published on this website and others should not delay. By way professional, I manage servers running RedHat or CentOS and VMware ESXi farm.
From time to time, I manage to drop my keyboard and read a book while listening to music, but it never lasts long.


Creative Commons License Published under Creative Common by-nc-sa license

Valid XHTML 1.0 Strict |  Valid CSS |  license Creative Common by-nc-sa


  1. Previously, about StatusNet
  2. Introduction
  3. Before diving into technical stuff
  4. Preparation
  5. PHP-FPM setup
  6. NGinx configuration as application pool
  7. MySQL setup
  8. StatusNet installation
  9. StatusNet initialisation
  10. SingleUser mode setup
  11. Sources and references
  12. About ...
  13. License