February 8, 2022

OTRS / Znuny on Ubuntu with nginx

This article describes how to configure OTRS in conjunction with nginx only.
This article content was tested with all Ubuntu versions 14.04, 12.04 and 10.04.

First install the required packages

apt-get install nginx fcgiwrap

Now edit your /etc/init.d/fcgiwrap to ensure that user and group are set to www-data. Also switch to the more efficient socket instead of using TCP ports. Your file should look like

NAME="fcgiwrap"
...
# FCGI_APP Variables
FCGI_CHILDREN="1"
FCGI_SOCKET="/var/run/$NAME.socket"
FCGI_USER="www-data"
FCGI_GROUP="www-data"
# Socket owner/group (will default to FCGI_USER/FCGI_GROUP if not defined)
FCGI_SOCKET_OWNER="www-data"
FCGI_SOCKET_GROUP="www-data"

Update your nginx server config /etc/nginx/nginx.conf or better your /etc/nginx/sites-enabled/default

server {
  server_name _;
  access_log /var/log/otrs-access.log;
  error_log /var/log/otrs-error.log;

  # prevent buffer problems in OTRS
  fastcgi_buffers 8 16k;
  fastcgi_buffer_size 32k;

  # Enter your htdocs path here, e.g. /opt/otrs/var/httpd/htdocs
  root /opt/otrs/var/httpd/htdocs;

  # Do not log favicon access
  location = /favicon.ico {
    access_log   off;
    log_not_found off;
  }

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

  location ~ ^/otrs/(.*\.pl)(/.*)?$ {
    gzip off;
    # Enter your fcgiwrap socket here
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    fastcgi_index index.pl;
    # Enter your OTRS cgi-bin path, e.g. /opt/otrs/bin/cgi-bin
    fastcgi_param SCRIPT_FILENAME /opt/otrs/bin/cgi-bin/$1;
    include fastcgi_params;
  }
}

Now update your /etc/nginx/fastcgi_params to

 fastcgi_param QUERY_STRING $query_string;
 fastcgi_param REQUEST_METHOD $request_method;
 fastcgi_param CONTENT_TYPE $content_type;
 fastcgi_param CONTENT_LENGTH $content_length;

 fastcgi_param SCRIPT_FILENAME $request_filename;
 fastcgi_param SCRIPT_NAME $fastcgi_script_name;
 fastcgi_param REQUEST_URI $request_uri;
 fastcgi_param DOCUMENT_URI $document_uri;
 fastcgi_param DOCUMENT_ROOT $document_root;
 fastcgi_param SERVER_PROTOCOL $server_protocol;

 fastcgi_param GATEWAY_INTERFACE CGI/1.1;
 fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

 fastcgi_param REMOTE_ADDR $remote_addr;
 fastcgi_param REMOTE_PORT $remote_port;
 fastcgi_param SERVER_ADDR $server_addr;
 fastcgi_param SERVER_PORT $server_port;
 fastcgi_param SERVER_NAME $server_name;

 fastcgi_param HTTPS $https if_not_empty;

This is the direct access of Znuny/OTRS via nginx, but you could also use nginx as reverse proxy ontop of apache.

Related articles

Related articles may be:

Do you need help with Znuny / OTRS?
We have lot of experiences with OTRS and Znuny and can help you with your issues. Get in touch with us and we will check if and how we can help you.

Leave a Comment

Your email address will not be published. Required fields are marked *

Do you need help with Znuny / OTRS?​

We have lot of experiences with OTRS and Znuny.
We can help you with your issues to solve them.

From giving you support up to implementing integrations to your existing systems.

Get in touch with us and we will check if and how we can help you.​

Get OTRS/Znuny/OTOBO Support
Our support experts prepare themself, by reviewing your business. Please Share your website URL
To get a quick and efficient clearance of your needs, our experts will call you.
We communicate in English.
Maybe we can communicate in your native language too. So please let us know your native written and spoken language.