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 http://hg.qwebirc.org/qwebirc 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.
cp config.py.example config.py
Edit config.py. 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
NETWORK_NAME = "IRCNet"
I wasn't sure what to see the URLs to, but here's how mine is set. Set REALNAME to the server address.
REALNAME = "https://www.domain.com/webirc"
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.
FORWARDED_FOR_HEADER="x-forwarded-for"
FORWARDED_FOR_IPS=["127.0.0.1"]
Finally compile qwebirc.
python compile.py
And test it
python run.py
You should be able to browse to http://localhost:9090/
# qwebirc - qwebirc job file
start on runlevel [2345]stop on runlevel [016]
chdir /usr/local/qwebirc
export fork
exec /usr/local/qwebirc/run.py
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;
proxy_pass http://127.0.0.1:9090/;
}
Restart nginx
sudo service nginx restart
And browse to https://www.domain.com/webirc