Fork me on GitHub

Настройка Trac в Ubuntu 14.04 с Basic Authentication (Nginx + uWSGI)

Tip

Ознакомится со статьёй битва титанов FreeSwitch vs. Asterisk

Install Trac

sudo apt-get install trac
sudo mkdir -p /var/trac/myproject
cd /var/trac/myproject
sudo trac-admin . initenv
# basic authentication
sudo apt-get install apache2-utils
sudo htpasswd -c .htpasswd adminusername
sudo trac-admin . permission add adminusername TRAC_ADMIN
# folder permissions
sudo chown -R www-data: .
sudo chmod -R 775 .
cp wsgi_trac.py -> /var/trac/myproject/
import os
import sys
import trac.web.main
sys.stdout=sys.stderr
os.environ['TRAC_ENV'] = '/var/trac/myproject'
application = trac.web.main.dispatch_request
cp to /etc/nginx/sites-enabled/trac.conf or add to /etc/nginx/nginx.conf
server {
  listen  80;
  server_name  trac.local;

    location / {
        auth_basic_user_file /var/trac/myproject/.htpasswd;
        auth_basic 'this is not for you';
        uwsgi_param REMOTE_USER $remote_user;

        include  uwsgi_params;
        uwsgi_pass  127.0.0.1:5544;
    }
}
cp trac_uwsgi.ini -> /etc/uwsgi/apps-enabled/
[uwsgi]
uid=trac
gid=tracsys
chmod-socket=777
chown-socket=trac
chdir = /var/trac/myproject
socket = 127.0.0.1:5544
module = wsgi_trac:application
processes = 2
master = 1
sudo service nginx restart && sudo service uwsgi restart

Comments