RT5 not working with apache2 on Ubuntu 20.04

I have implemented RT5 on Ubuntu 20.04. RT5 is behaving odd, It is working fine in standalone mode but when I try to run with apache it is giving me the error " Internal Server Error" on the browser.

Logs file “apache2.error” under the "/opt/rt5/var/log/ showing error as below.

[Thu Jul 22 04:45:22.280517 2021] [fcgid:warn] [pid 967:tid 140589873997568] (104)Connection reset by peer: [client 192.168.5.5:51566] mod_fcgid: error reading data from FastCGI server
[Thu Jul 22 04:45:22.280570 2021] [core:error] [pid 967:tid 140589873997568] [client 192.168.5.5:51566] End of script output before headers: rt-server.fcgi

apache2 configuration
0-------------------------------------
<VirtualHost rt.example.com:80">"
### Optional apache logs for RT
# Ensure that your log rotation scripts know about these files
ErrorLog /opt/rt5/var/log/apache2.error
TransferLog /opt/rt5/var/log/apache2.access
LogLevel debug

    AddDefaultCharset UTF-8

    ScriptAlias / /opt/rt5/sbin/rt-server.fcgi/

    DocumentRoot "/opt/rt5/share/html"
    <Location />
        Require all granted
        Options +ExecCGI
        AddHandler fcgid-script fcgi
    </Location>

</VirtualHost">"
0---------------------------------------------------------------------------------------------------------------

Apache fcgi moduel

root@rt:/opt/rt5/var/log# apachectl -t -D DUMP_MODULES | grep fcgid
fcgid_module (shared)

I searched many articles but didn’t get any solution even I scraped the system and build it according to sites.

If you turn on debugging in RT temporarily do you can any errors from the RT side of things?

Are the Linux file system rights setup correctly for the Ubuntu apache user/group?

Oooh, and is SELinux in the mix? Always one to catch me out in unexpected ways.

Error which I’m getting is

[Thu Jul 22 04:45:22.280517 2021] [fcgid:warn] [pid 967:tid 140589873997568] (104)Connection reset by peer: [client 192.168.5.5:51566] mod_fcgid: error reading data from FastCGI server
[Thu Jul 22 04:45:22.280570 2021] [core:error] [pid 967:tid 140589873997568] [client 192.168.5.5:51566] End of script output before headers: rt-server.fcgi

It is a Ubuntu, so nothing do with SELINUX.

What is the result of running ls -l /opt/rt5/sbin?

root@rt:~# ls -l /opt/rt5/sbin/
total 336
-rwxr-xr-x 1 root www-data 3302 Jul 21 16:14 rt-attributes-viewer
-rwxr-xr-x 1 root www-data 5242 Jul 21 16:14 rt-clean-sessions
-rwxr-xr-x 1 root www-data 15322 Jul 21 16:14 rt-dump-initialdata
-rwxr-xr-x 1 root www-data 11149 Jul 21 16:14 rt-dump-metadata
-rwxr-xr-x 1 root www-data 4849 Jul 21 16:14 rt-email-dashboards
-rwxr-xr-x 1 root www-data 12144 Jul 21 16:14 rt-email-digest
-rwxr-xr-x 1 root www-data 13501 Jul 21 16:14 rt-email-group-admin
-rwxr-xr-x 1 root www-data 8018 Jul 21 16:14 rt-externalize-attachments
-rwxr-xr-x 1 root www-data 12868 Jul 21 16:14 rt-fulltext-indexer
-rwxr-xr-x 1 root www-data 9289 Jul 21 16:14 rt-importer
-rwxr-xr-x 1 root www-data 3972 Jul 21 16:14 rt-ldapimport
-rwxr-xr-x 1 root www-data 6297 Jul 21 16:14 rt-munge-attachments
-rwxr-xr-x 1 root www-data 3636 Jul 21 16:14 rt-passwd
-rwxr-xr-x 1 root www-data 4249 Jul 21 16:14 rt-preferences-viewer
-rwxr-xr-x 1 root www-data 4753 Jul 21 16:14 rt-search-attributes
-rwxr-xr-x 1 root www-data 15410 Jul 21 16:14 rt-serializer
-rwxr-xr-x 1 root www-data 5811 Jul 21 16:14 rt-server
-rwxr-xr-x 1 root www-data 5811 Jul 21 16:14 rt-server.fcgi
-rwxr-xr-x 1 root www-data 3296 Jul 21 16:14 rt-session-viewer
-rwxr-xr-x 1 root www-data 24625 Jul 21 16:14 rt-setup-database
-rwxr-xr-x 1 root www-data 24291 Jul 21 16:14 rt-setup-fulltext-index
-rwxr-xr-x 1 root www-data 8514 Jul 21 16:14 rt-shredder
-rwxr-xr-x 1 root www-data 16018 Jul 21 16:14 rt-test-dependencies
-rwxr-xr-x 1 root www-data 11294 Jul 21 16:14 rt-validate-aliases
-rwxr-xr-x 1 root www-data 53449 Jul 21 16:14 rt-validator
-rwxr-xr-x 1 root www-data 5811 Jul 21 16:14 standalone_httpd
root@rt:~#

Hmm those look correct to me, are you using prefork MPM as your MPM?

Yes it is prefork

root@rt:/etc/apache2/mods-available# apache2ctl -M | grep mpm
mpm_prefork_module (shared)
root@rt:/etc/apache2/mods-available#

Since it works alone in standalone mode I am still tempted to think it is linux rights. Maybe the var/mason_data directory is weird. Can you try running make fixperms from the unpacked source code?

root@rt:/opt/rt-5.0.1# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
root@rt:/opt/rt-5.0.1#

Run the command “make fixperms” but same issue.

Full error log report

“[Thu Jul 22 13:19:20.012954 2021] [authz_core:debug] [pid 15177] mod_authz_core.c(817): [client 192.168.5.5:60792] AH01626: authorization result of Require all granted: granted
[Thu Jul 22 13:19:20.013004 2021] [authz_core:debug] [pid 15177] mod_authz_core.c(817): [client 192.168.5.5:60792] AH01626: authorization result of : granted
[Thu Jul 22 13:19:20.013051 2021] [authz_core:debug] [pid 15177] mod_authz_core.c(817): [client 192.168.5.5:60792] AH01626: authorization result of Require all granted: granted
[Thu Jul 22 13:19:20.013058 2021] [authz_core:debug] [pid 15177] mod_authz_core.c(817): [client 192.168.5.5:60792] AH01626: authorization result of : granted
[Thu Jul 22 13:19:20.322576 2021] [fcgid:warn] [pid 15177] (104)Connection reset by peer: [client 192.168.5.5:60792] mod_fcgid: error reading data from FastCGI server
[Thu Jul 22 13:19:20.322625 2021] [core:error] [pid 15177] [client 192.168.5.5:60792] End of script output before headers: rt-server.fcgi
[Thu Jul 22 13:19:20.351958 2021] [authz_core:debug] [pid 15178] mod_authz_core.c(817): [client 192.168.5.5:60794] AH01626: authorization result of Require all granted: granted, referer: http”://rt.silvertouch.com/
[Thu Jul 22 13:19:20.352000 2021] [authz_core:debug] [pid 15178] mod_authz_core.c(817): [client 192.168.5.5:60794] AH01626: authorization result of : granted, referer: http"://rt.silvertouch.com/
[Thu Jul 22 13:19:20.352048 2021] [authz_core:debug] [pid 15178] mod_authz_core.c(817): [client 192.168.5.5:60794] AH01626: authorization result of Require all granted: granted, referer: http:://rt.silvertouch.com/
[Thu Jul 22 13:19:20.352054 2021] [authz_core:debug] [pid 15178] mod_authz_core.c(817): [client 192.168.5.5:60794] AH01626: authorization result of : granted, referer: http:://rt.silvertouch.com/
[Thu Jul 22 13:19:20.659989 2021] [fcgid:warn] [pid 15178] (104)Connection reset by peer: [client 192.168.5.5:60794] mod_fcgid: error reading data from FastCGI server, referer: http:://rt.silvertouch.com/
[Thu Jul 22 13:19:20.660043 2021] [core:error] [pid 15178] [client 192.168.5.5:60794] End of script output before headers: rt-server.fcgi, referer: http:://rt.silvertouch.com/"

Does the webpage spin and then show the error or immediatly throw the error?If it spins it could be a timeout if the connection is taking a while for some reason, you can try adding the following configs:

  FcgidConnectTimeout 120
  FcgidMaxRequestLen 1073741824

  FcgidIOTimeout 120
  FcgidBusyTimeout 120

To /etc/apache2/mods-enabled/fcgid.conf

Same result on web page as well as in log file.

Can anyone provide me a step by step authenticated docs? So at least I can match with my setup.

Have you verified that Apache (www-data) has permissions to write to the request tracker log folder?

I installed (RT 5.0.1) from source on Ubuntu 20.04 myself, and got it running under apache2 but I had to fix the log folder permissions for request tracker (not the apache log).

In my /opt/rt5/etc/RT_SiteConfig.pm file the Set($LogDir… statement sets logs to be written into /var/log/rt5/, but only root had the ability to write into there originally.

chown -R www-data:www-data /var/log/rt5

resolved this for me…

Hi, I bumped into the same error as how the topic says… Did anyone by luck got the solution for it?

Did the chown on the log directory above not help?

Well it didn’t help, but I guess I shouldn’t have to be connected as ‘‘root@rt’’, but as the rt_user@rt. So most likely there was a problem from the veery beginning so I will do necessary fixes,checks and will restart to configure on tomorrow morning and will write back the feedback here.