AWstats 500 internal server error from web

OS type and version CentOS 7.9.2009
Webmin version 1.994
Virtualmin version 7.1
Related packages awstats 7.8

Hi Guys,

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, 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] End of script output before headers:

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

Hi Steven, this is what I have:

    <Directory /var/www/virtualmin/>
        allow from all
        AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
        Require all granted

In the cgi-bin dir I have this:

[root@server02 cgi-bin]# ls -ln
total 16
-rwxr-xr-x 1 1001 1001  61 Jul 29 02:35
lrwxrwxrwx 1 1001 1001  23 Jul 29 02:35 lang -> /usr/share/awstats/lang
lrwxrwxrwx 1 1001 1001  22 Jul 29 02:35 lib -> /usr/share/awstats/lib
-rwxr-xr-x 1 1001 1001  82 May 11 13:02 php5.cgi
-rwxr-xr-x 1 1001 1001 169 May 11 13:02 php7.2.cgi
-rwxr-xr-x 1 1001 1001 169 May 11 13:02 php7.3.cgi
lrwxrwxrwx 1 1001 1001  26 Jul 29 02:35 plugins -> /usr/share/awstats/plugins

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?

AddHandler cgi-script .cgi



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/

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?


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.