Setting qwebirc on Nginx

Written by Admin Sunday, 11 August 2013 02:48


For the web interface, we will install qwebirc and proxy it through Nginx on Ubuntu 12.04 Precise Pangolin.  The instructions for qwebirc are kind of in different places, so hopefully this will help someone.

In my case JDK is already installed, so the dependencies I needed where

sudo apt-get install python python-twisted python-twisted-bin \
python-twisted-core python-twisted-runner python-twisted-names \
python-twisted-mail python-twisted-words python-twisted-web \
python-zope.interface python-openss mercurial

Download the source somewhere

hg clone qwebirc

I decided to switch to their stable branch

hg up -C stable

Ok, in my case, I needed to apply two patches for SSL and server authentication.  For the authentication I applied the patch from here, direct link to the patch here.  For the SSL support I applied the patch from anacart's post in this thread, direct link to the patch here.

To apply the patch cd to the source root and do

patch -p1 < patch.diff

Once your done, put the qwebirc folder somewhere permanent, like /usr/local/qwebirc, or /usr/share/qwebirc, and make a copy of the config file.


Edit Change IRCPORT and SSL port to match the client port of your IRC server.

Set IDENT to a valid user on your LDAP domain.  I created an account called "webirc" in ldap-account-manager.

IDENT = "webirc"

Set the NETWORK to the IRC network name, specified in the inspircd.conf


I wasn't sure what to see the URLs to, but here's how mine is set. Set REALNAME to the server address.


Set BASE_URL to the local address, i don't think this is right, needs checking.

BASE_URL = "http://localhost:9090"

For the Nginx proxy, set the following.


Finally compile qwebirc.


And test it


You should be able to browse to http://localhost:9090/

Lastly, create a file to launch qwebirc as a service.  If qwebirc crashes, this script will not restart the process, it needs some tweaking. Edit /etc/init/qwebirc.conf
# qwebirc - qwebirc job file
start on runlevel [2345]stop on runlevel [016]
chdir /usr/local/qwebirc
export fork
exec /usr/local/qwebirc/
If all goes well, it should start on reboot, or by running
sudo service qwebirc start

Now to tweak Nginx.  I just had to add the following to /etc/nginx/sites-enabled/default

location ^~ /webirc/ {
proxy_set_header  Host             $host;
proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
proxy_set_header  X-Forwarded-Proto https;

Restart nginx

sudo service nginx restart

And browse to