Unit with Python


yum install -y gcc wget python-devel

wget https://github.com/nginx/unit/archive/1.4.tar.gz

tar zxf 1.4.tar.gz
cd unit-1.4
./configure --prefix=/usr/local/unit
./configure python
make && make install

ln -s /usr/local/unit/sbin/unitd /usr/sbin/

unitd --control 127.0.0.1:9800

echo "def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    return '

Hello, web!

'" > /www/html/wsgi.py echo '{"listeners":{"*:9801":{"application":"test"}},"applications":{"test":{"type":"python","path":"/www/html","module":"wsgi"}}}' > /tmp/app.json curl -X PUT -d @/tmp/app.json '127.0.0.1:9800/config'