OTRS Apache + mod_perl configuration on Debian/Ubuntu

Today I installed OTRS trouble ticketing system for a test (we’re evaluating different solutions). OTRS documentation is quite good, but the installation section could be more accurate.

Since it required to me a lot of searching and some mashing up between the contrib file from OTRS project and some examples found on the Internet, I want to share my configuration for Apache on Ubuntu (but it should work on Debian also). I changed the default vhost /etc/apache2/sites-available/default to:

<VirtualHost *:80>  
  ServerAdmin otrs@example.org
  DocumentRoot /opt/  

  <Directory />    
    Options FollowSymLinks    
    AllowOverride None  
  </Directory>

  # agent, admin and customer frontend  
  ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"  
  Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"

  # load perl modules  
  <IfModule mod_perl.c>
    Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl
    PerlModule Apache2::Reload    
    PerlInitHandler Apache2::Reload    
    PerlModule Apache2::RequestRec  
  </IfModule>

  # fallback to index.pl  
  <Location /otrs>    
    ErrorDocument 403 /otrs/index.pl    
    DirectoryIndex index.pl  
  </Location>

  # activate CGI/mod_perl for perl files  
  <LocationMatch /otrs/.*\.pl>    
    Options +ExecCGI    
    SetHandler cgi-script    
    Order allow,deny    
    Allow from all

    <IfModule mod_perl.c>      
      SetHandler perl-script      
      PerlHandler ModPerl::Registry      
      PerlOptions +ParseHeaders      
      PerlOptions +SetupEnv    
    </IfModule>

  </LocationMatch>

  # directory settings  
  <Directory "/opt/otrs/bin/cgi-bin/">    
    AllowOverride None    
    Options +ExecCGI -Includes    
    Order allow,deny    
    Allow from all  
  </Directory>

  <Directory "/opt/otrs/var/httpd/htdocs/">    
    AllowOverride None    
    Order allow,deny    
    Allow from all  
  </Directory>

  <IfModule mod_headers.c>    
    <Directory "/opt/otrs/var/httpd/htdocs/skins/*/*/css-cache">      
      <FilesMatch "\.(css|CSS)$">        
        Header set Cache-Control "max-age=2592000 must-revalidate"      
      </FilesMatch>    
    </Directory>

    <Directory "/opt/otrs/var/httpd/htdocs/js/js-cache">      
      <FilesMatch "\.(js|JS)$">        
        Header set Cache-Control "max-age=2592000 must-revalidate"      
      </FilesMatch>    
    </Directory>  
  </IfModule>

  ErrorLog /var/log/apache2/otrs_error.log  LogLevel warn

  CustomLog /var/log/apache2/otrs_access.log combined

</VirtualHost>
Advertisements

3 thoughts on “OTRS Apache + mod_perl configuration on Debian/Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s