Digioso has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I've setup a server and installed HestiaCP as a server management tool to install & control NGINX, Apache, Databases, .... It's an Ubuntu 22.04 server Unfortunately HestiaCP doesn't support Perl, so I installed the package for Mod_Perl myself and changed the Apache configuration accordingly. Now I started migrating stuff from my old webhoster to the new server. And... now I'm facing lots of problems. The problems seem to only occur when I use self-written modules. Using pre-existing modules doesn't cause any problems. The scripts and modules were running perfectly fine on my old webhoster. I just needed to change a few paths in the scripts/modules to refelct the new locations. So I am pretty sure that I do not have a syntax error or something like that. Around 50% of the time I can see in the web server log messages like these:
2023/02/24 14:36:45 [error] 1467#1467: *1180 upstream prematurely clos +ed connection while reading response header from upstream, client: 87 +.122.231.239, server: digioso.tk, request: "GET /test.pl HTTP/2.0", u +pstream: "https://10.0.0.113:8443/test.pl", host: "digioso.tk"
So... 50% of the time the page loads, 50% it doesn't. The upstream errors point to NGINX (at least all the search results I found on Google point there), but I couldn't find anything even remotely connected to my issue.
Links to test:test2.pl#!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use lib "/home/digioso/web/digioso.tk/stuff"; use Navi; Navi::print_navi(); print "test"; Navi::end_navi();
Navi.pm (located in /home/digioso/web/digioso.tk/stuff):#!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); my $cgi = new CGI; binmode STDOUT, ":utf8"; print $cgi->header (-type => 'text/html', -charset => 'UTF-8'); print "test2"; print $cgi->end_html;
#!/usr/bin/perl -w use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); package Navi; my $cgi = new CGI; binmode STDOUT, ":utf8"; sub print_navi { print $cgi->header (-type => 'text/html', -charset => 'UTF-8'); } sub end_navi() { print $cgi->end_html; }
So basically test1 outputs the same as test2. Only difference is that starting and ending HTML is done via a module. The original Navi.pm contains many more things (eg including CSS and so on), but for demonstration purposes I thinned it down to the above.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: upstream prematurely closed connection while reading response header from upstream
by Corion (Patriarch) on Feb 24, 2023 at 14:06 UTC | |
by Digioso (Sexton) on Feb 24, 2023 at 14:22 UTC | |
by Corion (Patriarch) on Feb 24, 2023 at 14:48 UTC | |
by Digioso (Sexton) on Feb 24, 2023 at 15:17 UTC | |
|
Re: upstream prematurely closed connection while reading response header from upstream
by cavac (Prior) on Feb 27, 2023 at 17:34 UTC |