title: apache suexec "command not in docroot"
body: <p>Error message is: </p>
  
  <pre><code>command not in docroot (/home/site1/cgi-bin/test.pl).
  </code></pre>
  
  <p><a href="https://wincent.com/wiki/Troubleshooting_suexec_errors" rel="noreferrer">Here</a> I found this:</p>
  
  <blockquote>
    <p>suexec requires the CGI script to be under the server's DocumentRoot (not the VirtualHost DocumentRoot). It is permitted, however, for the VirtualHost DocumentRoot to be a symlink to a directory that appears under the real DocumentRoot.</p>
  </blockquote>
  
  <p>a part of virtual host config is:</p>
  
  <pre><code>[...]
  DirectoryIndex index.html index.html index.php
  DocumentRoot /home/site1/htdocs
  
  SuexecUserGroup site1 site1
  
  ScriptAlias /cgi-bin/ /home/site1/cgi-bin/
  &lt;Location /home/site1/cgi-bin&gt;
             Options +ExecCGI
  &lt;/Location&gt;
  
  &lt;Directory /home/site1/&gt;
  Options -Includes -Indexes -FollowSymLinks +ExecCGI MultiViews
  AddHandler cgi-script .cgi .pl
  AllowOverride none
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  [...]
  </code></pre>
  
  <p>So, I prefer have Perl scripts inside cgi-bin, but if I can't resolve this problem I can move all scripts to htdocs.</p>