Closed iliajie closed 2 years ago
Regarding (2), which Linux distribution did you see this on? And did anything useful get written to logs/error_log
?
That was AlmaLinux. I don't remember exactly about errors in Nginx logs. But this error usually means that either a service isn't running or something is misconfigured under /cgi-bin
location in a server config.
Did you only see this on AlmaLinux?
Did you only see this on AlmaLinux?
I see it on both Alma 9 and Ubuntu 22.04 with Nginx.
However, I just found a "problem", as when you run scripts under Nginx it returns damn super confusing error (502 bad gateway), unless you don't print first print "Content-Type: text/html\n\n";
or even print " \n\n";
works which makes it even more ridiculous.
i.e. test.cgi
and fcgiwrap
with Apache and the following works:
#!/usr/bin/perl
print "Hello World";
However, under Nginx it prints misleading error in ~/logs/fcgiwrap.log
:
Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?
.. which makes absolutely no sense! It took me some time to understand what was really wrong. However, just "sending headers" with print "Content-Type: text/html\n\n";
makes it work with Nginx as well:
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "Hello World";
.. and more ridiculous this works too:
#!/usr/bin/perl
print " \n\n";
print "Hello World";
.. but why? And isn't that sick that the error message produced is so misleading? I know it's not our problem but still.
That's kind of expected - all CGI scripts must output proper headers. If not, the fcgiwrap
server probably just fails to process the output and returns an error to Nginx.
As for issue #3, it should be fixed by https://github.com/virtualmin/virtualmin-nginx/commit/7e65268da6a18ede469bba9c791417ab42511020
That's kind of expected - all CGI scripts must output proper headers.
Yes, yes I'm aware of that but the error message is deceptive!
As for issue https://github.com/virtualmin/virtualmin-nginx/issues/3, it should be fixed by https://github.com/virtualmin/virtualmin-nginx/commit/7e65268da6a18ede469bba9c791417ab42511020
That works, thanks!
Jamie, I was running more tests today on Nginx module and found few bugs:
Disabled
, PHP files where downloaded instead of shown as text due to incorrect mime type. Fixed on this commit in this PR - https://github.com/virtualmin/virtualmin-nginx/commit/cf6a0ece77bfbc43eeae2b1759c0d9b82fb8290esystemd
unit is setup correctly, the scripts are not executed (i.e. under/cgi-bin
directory) and an error always displayed:Disabled
set for PHP execution mode then still a newly created website hasFCGId
setup by default (when should beDisabled
as defined on the template)Can you please pull this branch and check in a fix for
#2
and#3
please? Also, check if#1
looks good to you as it works perfectly fine for me.