This is a small tutorial on running OTRS on a nginx webserver. The tutorial is based on Ubuntu 14.04 LTS but has also been tested on Ubuntu 12.04 LTS, 11.10 and 10.04 LTS before. (mind that you will have to use backports or self compiled software in some cases – with 14.04 everything is fine):
- Installnginxon your system
aptitude install nginx
- Installfcgiwrapon your system
aptitude install fcgiwrap
- Edit your /etc/init.d/fcgiwrap and assure that it will startup as user and group www-data (our the equivalent of your system). Also ensure that it is using a socket instead of a TCP port. The following code is part of the init script.
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"
- Create a new nginx server config for your OTRS installation. It look look like this:
server { server_name <YOUR_SERVER_NAME>; access_log <YOUR_ACCESS_LOG_FILE>; # These 2 lines were necessary to 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 <YOUR_OTRS_HTDOCS_PATH>; # Do not log favicon access location = /favicon.ico { access_log off; log_not_found off; } location /otrs-web/ { alias <YOUR_OTRS_HTDOCS_PATH>; } 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. <YOUR_OTRS_PATH>/bin/cgi-bin fastcgi_param SCRIPT_FILENAME <YOUR_OTRS_CGIBIN_PATH>/$1; include fastcgi_params; } }
- Your /etc/nginx/fastcgi_params should look like this:
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;
- Reload your nginx configurations
/etc/init.d/nginx reload
- Install your OTRS as usual but simply omit all Apache specific steps (there should be none anymore)
OTRS will run extremly fast and with low CPU and memory usage! All our OTRS demos are using this setup.
Please remember that nginx does not support .htaccess files – add all options to your server configuration
This setup allows you to install as many OTRS instances as you want.
This guide is based on the OTRS 2.4 instructions from tuxis.nl