After installing Web2Py with this script:
http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
I made some changes to integrate a Mercurial server.
It seem to work but I'm a newbie, so I would like someone give me feedback.
Thanks.
===== Mercurial =====
== install ==
apt-get install mercurial
adduser --ingroup www-data hg
== users ==
cd /home/hg/
htpasswd -mc hgusers hg
htpasswd -m hgusers pc-user
== config ==
vi /home/hg/hgweb.config
[paths]
/ = /var/www/web2py/applications/*
== wsgi script ==
mkdir /var/www/hg/
cp /usr/share/doc/mercurial-common/examples/hgweb.wsgi /var/www/hg/
chown hg:www-data /var/www/hg/hgweb.wsgi
vi /var/www/hg/hgweb.wsgi
config = "/home/hg/hgweb.config"
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb
application = hgweb(config)
=====uWSGI =====
vi /etc/uwsgi/apps-available/web2py.xml
<uwsgi>
<plugin>python</plugin>
<socket>127.0.0.1:9001</socket>
<pythonpath>/var/www/web2py/</pythonpath>
<mount>/w2p=/var/www/web2py/wsgihandler.py</mount>
<mount>/hg=/var/www/hg/hgweb.wsgi</mount>
<manage-script-name/>
</uwsgi>
(thanks to Roberto for this)
===== Nginx =====
vi /etc/nginx/sites-available/web2py
server {
listen 443;
server_name $hostname;
ssl on;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
location / {
uwsgi_pass 127.0.0.1:9001;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
}
location /hg {
auth_basic "Secure Login";
auth_basic_user_file /home/hg/hgusers;
uwsgi_pass 127.0.0.1:9001;
include uwsgi_params;
uwsgi_param SCRIPT_NAME "";
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;
}
}
https://<hostname>/w2p/ ==> Web2Py (or https://<hostname>/)
https://<hostname>/hg/ ==> Hg