Domanda

Error message is:

command not in docroot (/home/site1/cgi-bin/test.pl).

Here I found this:

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.

a part of virtual host config is:

[...]
DirectoryIndex index.html index.html index.php
DocumentRoot /home/site1/htdocs

SuexecUserGroup site1 site1

ScriptAlias /cgi-bin/ /home/site1/cgi-bin/
<Location /home/site1/cgi-bin>
           Options +ExecCGI
</Location>

<Directory /home/site1/>
Options -Includes -Indexes -FollowSymLinks +ExecCGI MultiViews
AddHandler cgi-script .cgi .pl
AllowOverride none
Order allow,deny
Allow from all
</Directory>
[...]

So, I prefer have Perl scripts inside cgi-bin, but if I can't resolve this problem I can move all scripts to htdocs.

È stato utile?

Soluzione

suEXEC has its own docroot which is totally independent of whatever you configure in your Apache config. You can see what suEXEC's docroot is by calling:

suexec -V

You may need to be root for that. In my case the docroot was /var/www. You'll have to put your scripts there. There is no way to change this save recompiling suEXEC. Don't try to use symbolic links to keep your scripts outside of /var/www (or whatever your suEXEC is configured to).

Edit: as mentioned by @insaner in the comments the command is probably suexec or as I have seen on at least one server suexec2. suEXEC is just what the Apache documentation calls the module/feature.

Altri suggerimenti

There is a config in /etc/apache2/suexec/www-data with below first 2 lines if you are using apache2-suexec-custom package.

/var/www
public_html/cgi-bin

You need to replace those lines with your setup. There SHOULD be 2 lines. Giving only one line will through error.

I used something like below,

home
cgi-bin

Change DocumentRoot /home/site1/htdocs to DocumentRoot /home/site1/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top