OTRS mit Nginx und Plack / Starman

Howto's zu OTRS Themen. Keine neuen Topics mit Fragen in diesem Forum!
Post Reply
Andre Bauer
Znuny guru
Posts: 2189
Joined: 08 Dec 2005, 17:01
Znuny Version: 5.0.x
Real Name: André Bauer
Company: Magix Software GmbH
Location: Dresden
Contact:

OTRS mit Nginx und Plack / Starman

Post by Andre Bauer »

Hier mal eine schnelle Anleitung, wie man sich mit Nginx nicht mit dem lahmen CGI/FCGI rumärgern muss.

So getestet auf Ubuntu Saucy mit OTRS 2.4.15 und 3.3.5.

Code: Select all

apt-get install starman libcgi-emulate-psgi-perl libfile-pushd-perl libcgi-compile-perl libio-interactive-perl libemail-valid-perl libcrypt-passwdmd5-perl libjson-perl libcss-minifier-perl
nginx-otrs.conf

Code: Select all

server {
    listen :80;
    server_name otrs.local;

    access_log /var/log/nginx/otrs.access.log;
    error_log  /var/log/nginx/otrs.error.log;

    root /opt/otrs/var/httpd/htdocs;

    index index.html;

    client_max_body_size 20M;

    location /otrs-web {
	alias /opt/otrs/html/var/httpd/htdocs;
    }

    location / {
	  proxy_pass http://otrs.local:8080;
    }
}

app.psgi (muss ins OTRS root verzeichnis):

Code: Select all

use Plack::App::CGIBin;
use Plack::Builder;
use HTTP::Server::PSGI;
use Plack::App::File;
use lib "/opt/otrs";
use lib "/opt/otrs/Kernel/cpan-lib";

my $app_main = Plack::App::WrapCGI->new(script => "/opt/otrs/bin/cgi-bin/index.pl")->to_app;
my $app_customer = Plack::App::WrapCGI->new(script => "/opt/otrs/bin/cgi-bin/customer.pl")->to_app;
my $app_web = Plack::App::File->new(root => "/opt/otrs/var/httpd/htdocs")->to_app;
builder {
      mount "/otrs" => $app_main;
      mount "/helpdesk" => $app_customer;
      mount "/otrs-web" => $app_web;
};

init script (um starman server zu starten):

Code: Select all

#!/bin/bash

### BEGIN INIT INFO
# Provides:        starman
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:    $remote_fs $network $syslog
# Default-Start:    2 3 4 5
# Default-Stop:        0 1 6
# Short-Description:    Start otrs 
# Description:        Starman otrs start at boot time
### END INIT INFO

DESC="otrs"
USER="otrs"
GROUP="otrs"
DIR="/opt/otrs"
LOG="/var/log/otrs.log"
SERVER="otrs.local"
PORT="8080"

set -e

case "$1" in
    start)
    echo -e "Starting ${DESC}..."
    cd ${DIR}
    /usr/bin/starman --preload-app -MDBD::mysql -MKernel::System::Ticket --user ${USER} --group ${GROUP} --listen ${SERVER}:${PORT} --pid /var/run/${DESC}.pid --error-log ${LOG} --daemonize
    ;;

    stop)
    echo -e "Stopping ${DESC}..."
    kill $(cat /var/run/${DESC}.pid)
    ;;

    restart)
    echo -e "Restarting ${DESC}..."
        kill $(cat /var/run/${DESC}.pid)
    cd ${DIR}
    /usr/bin/starman --preload-app -MDBD::mysql -MKernel::System::Ticket --user ${USER} --group ${GROUP} --listen ${SERVER}:${PORT} --pid /var/run/${DESC}.pid --error-log ${LOG} --daemonize

    ;;

    *)
    echo "Usage: {start|stop|restart}" >&2
    exit 1
    ;;
esac

exit 0
Prod: Ubuntu Server 16.04 / Zammad 1.2

DO NOT PM ME WITH OTRS RELATED QUESTIONS! ASK IN THE FORUMS!

OtterHub.org
Post Reply