I can’t get AWStats to work from web. It works when I use it from Virtualmin (Logs and Reports → AWStats Report), but when I visit https://mysite.com/awstats/awstats.pl, after passing basic auth I get 500 Internal Server Error. Error log output shows:
[Fri Jul 29 03:29:39.832455 2022] [cgi:error] [pid 24242] [client 194.195.252.151:52671] End of script output before headers: awstats.pl
I saw similar topics on the forum, but they are closed or very old so I decided to open a new one.
There is very little info to go from, though this seems like an error in the CGI section of the website’s domain configuration. could you post the relevant domains config section for awstats? you can find it ( assuming you run the website under apache ) by going to webmin → servers → apache webserver → TAB global configuration → edit config files. in this file you should find blocks starting with or and then ending with The block you are looking for should look something like this
<Directory /home/DOMAIN/cgi-bin>
#allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler cgi-script .cgi
Require all granted
</Directory>
<Directory /var/www/virtualmin/mysite.com/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
the only thing I’m missing is the AddHandler for the cgi files, could you try adding the line in the block below to that config section between the AllowOverride and Require lines, then save the config, then stop and start apache, and then check the page again to see of it works?
There is ScriptAlias directive already there that covers it. I found it’s a suexec problem:
Aug 2 22:37:11 server02 suexec[24218]: command not in docroot (/var/www/virtualmin/mysite.com/cgi-bin/helloworld.pl)
I know the standard suexec does not allow to modify the docroot that it was compiled with, but nn Ubuntu, there is a modified version of suexec that allows to configure it - I have a few machines where I did it, but for CentOS (my current machine), this does not seem to be available. All I was able to find is to recompile suexec. Am I missing something obvious?