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 关系型数据库 应用服务中间件
|
3月前
|
缓存 应用服务中间件 网络安全
Nginx中配置HTTP2协议的方法
Nginx中配置HTTP2协议的方法
245 7
|
4月前
|
应用服务中间件 BI nginx
Nginx的location配置详解
【10月更文挑战第16天】Nginx的location配置详解
|
4月前
|
缓存 负载均衡 安全
Nginx常用基本配置总结:从入门到实战的全方位指南
Nginx常用基本配置总结:从入门到实战的全方位指南
537 0
|
1月前
|
存储 应用服务中间件 Linux
nginx配置证书和私钥进行SSL通信验证
nginx配置证书和私钥进行SSL通信验证
69 4
|
3月前
|
负载均衡 监控 应用服务中间件
配置Nginx反向代理时如何指定后端服务器的权重?
配置Nginx反向代理时如何指定后端服务器的权重?
240 61
|
3月前
|
安全 应用服务中间件 网络安全
如何测试Nginx反向代理实现SSL加密访问的配置是否正确?
如何测试Nginx反向代理实现SSL加密访问的配置是否正确?
253 60
|
3月前
|
安全 应用服务中间件 网络安全
配置Nginx反向代理实现SSL加密访问的步骤是什么?
我们可以成功地配置 Nginx 反向代理实现 SSL 加密访问,为用户提供更安全、可靠的网络服务。同时,在实际应用中,还需要根据具体情况进行进一步的优化和调整,以满足不同的需求。SSL 加密是网络安全的重要保障,合理配置和维护是确保系统安全稳定运行的关键。
329 60
|
2月前
|
存储 应用服务中间件 nginx
nginx反向代理bucket目录配置
该配置实现通过Nginx代理访问阿里云OSS存储桶中的图片资源。当用户访问代理域名下的图片URL(如 `http://代理域名/123.png`)时,Nginx会将请求转发到指定的OSS存储桶地址,并重写路径为 `/prod/files/2024/12/12/123.png`。
116 5