ApacheConfig

From Request Tracker Wiki
Jump to: navigation, search

Consult with ManualApacheConfig for intial configuration of the apache server for RT.

Here you'll find some tips and additional notes.

Separate apache log files for RT

Add the following lines to your RT's virtual host in the apache config:

ErrorLog /opt/rt3/var/log/apache2.error

TransferLog /opt/rt3/var/log/apache2.access

Don't forget to create these files and grant rights to apache's user.

mod_perl and caching connections to the DB

Apache::DBI is perl module that works under mod_perl only and add transparent caching of connections to the DB. It may be helpful to do that as connect to some databases may be slow. If you followed ManualApacheConfig and using mod_perl then most probably you have Apache::DBI module installed.

Add the following line to RT's virtual host config:

PerlModule Apache::DBI

If apache doesn't restart, check the error_log file in the logs directory (e.g. /usr/local/apache2/logs/error_log). If you see something like:

Can't locate Apache/DBI.pm in @INC

it is likely that Apache::DBI could not be found on your system.

Use the following command to install the module or use system package tools:

perl -MCPAN -e 'install Apache::DBI'

If this fails one of the tests it will report that the installation would have to be forced. Whether that is a good idea is up to you:

perl -MCPAN -e 'force install Apache::DBI'

NOTE Apache::DBI 0.94 only comes with tests that work with mysql. README says

# only works with MySQL so far; patches welcome

so if you are using postgres, you will have to force it anyway.

How to avoid processing images like dynamic content

Problem

If you have mod_perl or FastCGI handler on location / then all files are handled by this handler. For example FastCGI try to execute your RT logo image like other dynamic scripts. This will cause the RT logo to be sent down as text/ascii, resulting in a "broken" image.

Solution

Add to httpd.conf

<Location /NoAuth/images >

    SetHandler default-handler
</Location>

Also, make sure that your

Alias /NoAuth/images/ /opt/rt3/share/html/NoAuth/images

(if you have one) is ABOVE the ScriptAlias line pointing at mason_handler.fcgi.

Apache/mod_perl 1.x config for debug purposes

This is for developers only and is no help for mortal users.

<IfDefine PerlDProf>

  <Perl>
    use Apache::DB ();
    Apache::DB->init;
  </Perl>

<IfDefine !PerlSmallProf>

    PerlModule Apache::DProf
  </IfDefine>
</IfDefine>

<IfDefine PerlStatus>

  PerlModule Apache::Status
</IfDefine>

<IfDefine PerlDBIProf>

  PerlSetEnv DBI_PROFILE DBI::ProfileDumper::Apache
</IfDefine>
PerlModule Apache::DBI

ServerName XXXXXXXXXXXX

DocumentRoot /opt/rt3/share/html
Listen xxx.xxx.xxx.xxx:xxxxx

AddDefaultCharset UTF-8

ErrorLog /opt/rt3/var/log/mod_perl.httpd.error.log

CustomLog /opt/rt3/var/log/mod_perl.httpd.access.log common

PerlRequire /opt/rt3/bin/webmux.pl

<Location />

  Options None
  SetHandler perl-script
  PerlHandler RT::Mason
  <IfDefine PerlDProf>
    <IfDefine PerlSmallProf>
      PerlFixupHandler Apache::SmallProf
    </IfDefine>
  </IfDefine>
</Location>

<Location /NoAuth/images>

  SetHandler default-handler
</Location>

<IfDefine PerlStatus>

  <Location /perl-status>
    SetHandler perl-script
    PerlHandler Apache::Status
    PerlSetVar StatusOptionsAll On
    PerlSetVar StatusTerse On
    PerlSetVar StatusTerseSize On
    PerlSetVar StatusTerseSizeMainSummary On
    PerlSetVar StatusLexInfo On
  </Location>
</IfDefine>