Categories Tutorials

Install and run TiddlyWiki on a CentoOS 6 VPS using Nginx

In this tutorial we will guide you through the steps of installing and running TiddlyWiki on a CentOS 6 VPS.

We will also install and configure Nginx as a reverse proxy, so you can run TiddlyWiki behind Nginx.

What is TiddlyWiki?

It is an open-source single page application wiki. The content is divided into a series of components called Tiddlers.


Make sure you are in a screen session and check if your Linux VPS is fully up-to-date by running:

## screen -U -S tiddlywiki-screen
## yum update


We need some development tools on the system in order to build NodeJs. Install the Development Tools meta package using yum

## yum groupinstall "Development Tools"


Compile and install NodeJs using the following commands:

## mkdir -p /opt/build
## cd /opt/build
## wget http://nodejs.org/dist/node-latest.tar.gz
## tar xzvf node-latest.tar.gz
## cd node-v*
## ./configure
## make
## make install


Install TiddlyWiki with the following command

## npm install -g tiddlywiki

Check TiddlyWiki is installed by executing

## tiddlywiki --version

Create user for tiddlywiki

## useradd -m tiddlywiki
## su - tiddlywiki

Set-up a new wiki using

## tiddlywiki mywiki --init server
## tiddlywiki mywiki --server

tiddlywiki can be invoked like this

tiddlywiki --server <port> <roottiddler> <rendertype> <servetype> <username> <password> <host>

where the parameters are:

  • port – port number to serve from (defaults to “8080”)
  • roottiddler – the tiddler to serve at the root (defaults to “$:/core/save/all”)
  • rendertype – the content type to which the root tiddler should be rendered (defaults to “text/plain”)
  • servetype – the content type with which the root tiddler should be served (defaults to “text/html”)
  • username – the default username for signing edits
  • password – optional password for basic authentication
  • host – optional hostname to serve from (defaults to “” aka “localhost”)


In order to install Nginx in your CentOS 6 linux vps, you need to have EPEL repository enabled on the system, so enable it using:

## wget -P /tmp http://mirror.itc.virginia.edu/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
## rpm -Uvh /tmp/epel-release-6-8.noarch.rpm
## rm -f /tmp/epel-release-6-8.noarch.rpm

once EPEL is enabled on the system, install Nginx using yum

## yum install nginx

set-up server block

## vim /etc/nginx/conf.d/twiki.conf
server {
    listen           80;
    server_name      mydomain.tld;
    # vhost specific logs
    access_log       /var/log/nginx/mydomain.tld.access.log combined;
    location / {
        proxy_set_header        Host             $host;
        proxy_set_header        X-Real-IP        $remote_addr;
        proxy_set_header        X-Forwarded-For  $proxy_add_x_forwarded_for; 

restart nginx and add it to your system’s start-up

## service nginx restart
## chkconfig nginx on

to make TiddlyWiki to be automatically started on system start-up, we need to create the following init script:

## vim /etc/init.d/tiddlywiki

# chkconfig: 35 99 99
# description: tiddlywiki

. /etc/rc.d/init.d/functions




        if [ ! -f "$LOCK_FILE" ] ; then
                echo -n $"Starting $SERVER: "
                runuser -l "$USER" -c "$DAEMON $PARAMS &" && echo_success || echo_failure
                [ $RETVAL -eq 0 ] && touch $LOCK_FILE
                echo "$SERVER is locked."
        echo -n $"Stopping $SERVER: "
        pid=`ps -aefw | grep "$DAEMON $SERVER" | grep -v " grep " | awk '{print $2}'`
        kill -9 $pid > /dev/null 2>&1 && echo_success || echo_failure
        [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE

case "$1" in
                echo "Usage: $0 {start|stop|restart}"

exit $RETVAL
## chmod +x /etc/init.d/tiddlywiki
## chkconfig tiddlywiki on


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 TiddlyWiki 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.


View Comments

  • Thank you for featuring TiddlyWiki, much appreciated! There's a minor tweak needed since the latest 5.0.8-beta version of TiddlyWiki. The instructions to set up a new wiki should be: ## tiddlywiki mywiki --init ## tiddlywiki mywiki --server Instead of: ## mkdir mywiki ## cd mywiki ## tiddlywiki --server

  • The is a bug in the code: Instead of: tiddlywiki mynewwiki --init the command should be tiddlywiki mynewwiki --init server The first creates a normal "empty" wiki that is made for using in offline mode, it doesn't use nodejs and you can connect but it doesn't save anything to the server instead just asks to save offline when you want to close the page. Refusing to do so will erase all changes next time you visit the page. Source: http://tiddlywiki.com/static/Installing%2520TiddlyWiki%2520on%2520Node.js.html

  • I wish to configure my wiki to be accessible as a folder under the existing domain my.domain.com/tiddlywiki and I tried the configuration as follows location /tiddlywiki/ { proxy_pass; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } The tiddlywiki loads in the browser and the basic auth configured also succeeds but, Saving changes fails. I observe nginx access log that show requests to /recipes/ & /status/ that are failing with 404 Any clue would be appreciated.

    • @Rajeev: There is a command-line option `prefix` to pass to `tiddlywiki` so that the folder is appended to requests URLs to the server. More info in the TiddlyWiki Docs: http://tiddlywiki.com#Using%20a%20custom%20path%20prefix%20with%20the%20client-server%20edition

  • So I wanted to run several TW on the same machine but inside different folders. I went with the Nginx proxy solution (though I would have preferred Apache since I've always used it & never even touched Nginx). I tried the path prefix solution first (because I didn't want to make changes to the TW itself) but it failed even after trying all four methods to write path prefix (with & without / at start & end of the path) : - protocol is http - host is local (192.168.x.x) - node is on simple folder (eg. http://192.168.x.x/node/) Instance can be accessed as usual on both the direct URL & the proxy URL, but can't be saved from the proxy URL.