OTRS in Nginx using FCGI (multiple users possible)

简介:
原文

OTRS in Nginx using FCGI (multiple users possible)
There might be a more up2date version of this how-to here.
OTRS is a very extensive Trouble Ticketing System. It is written in Perl, which has some advantages, but causes some issues performancewise.
One way to deal with it is by running OTRS in Apache with mod_perl. That definitely improves OTRS' performance but introduces another issue. You cannot combine mod_perl with mod_itk, a module to run various sites as various users. If you would choose to run OTRS in mod_perl, you must run all sites as www-data (or the equivalent of your distro).
I've been searching for a solution to run OTRS fast, but with the possibility to run OTRS as a seperate user.
OTRS has thought of the possibility to run it using fcgi, but documentation on howto setup fcgi properly was lacking. Running OTRS as a seperate user seemed to be a challenge.
I finally ended up with Nginx (any other webserver supporting fcgi will probably do fine too), combined with spawn-fcgi. This howto expects you to use Ubuntu and only covers installing OTRS and it's webserver.
Installation

Software:
Apart from software found in Ubuntu's repositories by default, we also use multiwatch which isn't available in Ubuntu itself, but it does have an apt-repository present. To add it to your system, run:
root@otrs:~# wget -O /etc/apt/sources.list.d/multiwatch.list http://www.tuxis.nl/uploads/howtos/otrs-fcgi/multiwatch.list
root@otrs:~# apt-key adv --keyserver keys.gnupg.net --recv-keys 80121CD2479689D8
root@otrs:~# apt-get update
Now install all software:
root@otrs:~# apt-get install mysql-server nginx spawn-fcgi libnet-dns-perl libio-socket-ssl-perl libnet-ldap-perl libgd-text-perl libgd-graph-perl libpdf-api2-perl libsoap-lite-perl libuser libcgi-fast-perl multiwatch
OTRS:
Create a new user for OTRS:
root@otrs:~# adduser otrs --disabled-login
Adding user `otrs' ...
Adding new group `otrs' (1001) ...
Adding new user `otrs' (1001) with group `otrs' ...
Creating home directory `/home/otrs' ...
Copying files from `/etc/skel' ...
Changing the user information for otrs
Enter the new value, or press ENTER for the default
       Full Name []: OTRS Webuser
       Room Number []: 
       Work Phone []: 
       Home Phone []: 
       Other []: 
Is the information correct? [Y/n] y
Now become the new user and download OTRS. Unpack the archive and make sure that you create a symlink named 'otrs' to the extracted directory. This will make upgrades easier. Also make sure that the file otrs/Kernel/Config.pm exists, and that the path to your OTRS-installation in that file is correct.
root@otrs:~# su - otrs
otrs@otrs:~$ wget http://ftp.otrs.org/pub/otrs/otrs-2.4.7.tar.bz2
otrs@otrs:~$ tar xjvf otrs-2.4.7.tar.bz2
otrs@otrs:~$ ln -s otrs-2.4.7 otrs
otrs@otrs:~$ mv otrs/Kernel/Config.pm.dist otrs/Kernel/Config.pm
Edit otrs/Kernel/Config.pm and configure the correct path, in this case "/home/otrs/otrs/"
Configuration

Spawn-fcgi isn't started upon request. The goal is to achieve better performance, and starting it over and over again isn't very efficient. So we need to start all processes ahead.
You can create your own script to fix that, but you can also download this script, or use it as an inspiration. It will arrange for the users you enter to configure Nginx and the Fcgi-setup. It expects Ubuntu's Upstart so if you're using another operatingsystem, this might not work as expected..
Now run the script for the user you created before. It's possible that the script asks for a hostname for the vhost that will be created:
root@otrs:~# ./ngfcgiotrs otrs
Created upstart config for customer.pl
Created upstart config for index.pl
Created upstart config for installer.pl
Created upstart config for public.pl
Starting service: customer.pl ... index.pl ... installer.pl ... public.pl ... Create vhost-config for otrs.tuxis.net
There is now a upstart job for every file found in the fcgi-bin directory. These will always be running, whether the webserver is running or not. If any of the processes crash, it will automatically be started again. You can find the created files here:
/etc/init/otrs/otrs/index.pl.conf
/etc/init/otrs/otrs/installer.pl.conf
/etc/init/otrs/otrs/customer.pl.conf
/etc/init/otrs/otrs/public.conf
/etc/nginx/sites-available/<vhost-name>
All that remains is enabling the website and installing OTRS:
root@otrs:~# cd /etc/nginx/sites-enabled/
root@otrs:/etc/nginx/sites-enabled# ln -s ../sites-available/otrs.tuxis.net 
root@otrs:/etc/nginx/sites-enabled# /etc/init.d/nginx restart
Restarting nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
nginx.
OTRS will be running completely after this install. When you need to stop or start any of the fcgi-services, you can do so by typing:
root@otrs:~# stop otrs/$username/index.pl
root@otrs:~# start otrs/$username/index.pl
Where $username is obviously the user for whom you want to restart the service.
installer.pl has an alternative version of the init-script, so it won't start automatically after the install. If you ever need to redo the install or run an upgrade, you can make the installer available by typing:
root@otrs:~# start otrs/$username/installer.pl
相关文章
|
Oracle 关系型数据库 应用服务中间件
|
2月前
|
编解码 应用服务中间件 Linux
centos配置nginx-rtmp实现ffmpeg转码rtsp为rtmp视频流
centos配置nginx-rtmp实现ffmpeg转码rtsp为rtmp视频流
234 1
|
6月前
|
应用服务中间件 Linux 网络安全
Centos 8.0中Nginx配置文件和https正书添加配置
这是一份Nginx配置文件,包含HTTP与HTTPS服务设置。主要功能如下:1) 将HTTP(80端口)请求重定向至HTTPS(443端口),增强安全性;2) 配置SSL证书,支持TLSv1.1至TLSv1.3协议;3) 使用uWSGI与后端应用通信(如Django);4) 静态文件托管路径设为`/root/code/static/`;5) 定制错误页面(404、50x)。适用于Web应用部署场景。
692 87
|
6月前
|
负载均衡 应用服务中间件 nginx
Nginx配置与命令
Nginx 是一款高性能的 HTTP 和反向代理服务器,其配置文件灵活且功能强大。本文介绍了 Nginx 配置的基础结构和常用指令,包括全局块、Events 块、HTTP 块及 Server 块的配置方法,以及静态资源服务、反向代理、负载均衡、HTTPS 和 URL 重写等功能实现。此外,还提供了常用的 Nginx 命令操作,如启动、停止、重载配置和日志管理等,帮助用户高效管理和优化服务器性能。
|
2月前
|
Ubuntu 安全 应用服务中间件
详细指南:配置Nginx服务器在Ubuntu平台上
以上步骤涵盖了基本流程:从软件包管理器获取 Ngnix, 设置系统服务, 调整UFW规则, 创建并激活服务器块(也称作虚拟主机), 并进行了初步优化与加固措施。这些操作都是建立在命令行界面上,并假设用户具有必要权限(通常是root用户)来执行这些命令。每个操作都有其特定原因:例如,设置开机启动确保了即使重启后也能自动运行 Ngnix;而编辑server block则定义了如何处理进入特定域名请求等等。
227 18
|
2月前
|
Ubuntu 安全 应用服务中间件
详细指南:配置Nginx服务器在Ubuntu平台上
以上步骤涵盖了基本流程:从软件包管理器获取 Ngnix, 设置系统服务, 调整UFW规则, 创建并激活服务器块(也称作虚拟主机), 并进行了初步优化与加固措施。这些操作都是建立在命令行界面上,并假设用户具有必要权限(通常是root用户)来执行这些命令。每个操作都有其特定原因:例如,设置开机启动确保了即使重启后也能自动运行 Ngnix;而编辑server block则定义了如何处理进入特定域名请求等等。
260 17
|
3月前
|
数据建模 应用服务中间件 PHP
配置nginx容器和php容器协同工作成功,使用ip加端口的方式进行通信
本示例演示如何通过Docker挂载同一宿主目录至Nginx与PHP容器,实现PHP项目运行环境配置。需注意PHP容器中监听地址修改为0.0.0.0:9000,并调整Nginx配置中fastcgi_pass指向正确的IP与端口。同时确保Nginx容器中/var/www/html权限正确,以避免访问问题。
配置nginx容器和php容器协同工作成功,使用ip加端口的方式进行通信
|
4月前
|
应用服务中间件 网络安全 nginx
配置Nginx以支持Websocket连接的方法。
通过上述配置,Nginx将能够理解WebSocket协议的特殊要求,代理Websocket流量到合适的后端服务器。注意,Websocket并不是HTTP,尽管它最初是通过HTTP请求启动的连接升级,因此保证Nginx了解并能够妥善处理这种升级流程是关键。
902 10
|
3月前
|
Ubuntu 应用服务中间件 Linux
在Ubuntu上配置Nginx实现开机自启功能
至此,Nginx应该已经被正确地设置为开机自启。在Ubuntu中利用 `systemd`对服务进行管理是一种高效的方式,为系统管理员提供了强大的服务管理能力,包括但不限于启动、停止、重启服务,以及配置服务的开机自启动。通过这些简洁的命令,即使是对Linux不太熟悉的用户也能轻松地进行配置。
150 0