I am running Ubuntu 16.04 as a virtual machine. I have Apache2 2.4.18 installed.
I have a folder with cgi scripts that I want to use. To do that I placed a symlink to that folder in /usr/lib/cgi-bin.
When I call the script from firefox localhost/cgi-bin/linkName/script.cgi
I get 403 forbidden error.
When I copy the script.cgi to /usr/lib/cgi-bin
and call it with localhost/cgi-bin/script.cgi
, it runs but gives a software error since it lacks the surrounding files and folders.
I have chmod 777
both the link and the folder it links to but I still get the error.
What else can I do other than coping all the files and folders into /usr/lib/cgi-bin
?
It is because the symbolic link points to a directory, which is located outside of directories listed in your "virtualhost".conf
files. So you need to write down necessary directives in your /etc/apache2/apache2.conf
(or /etc/apache2/sites-available/*.conf
or /etc/apache2/conf-available/*.conf
) file to access /usr/lib/cgi-bin
. Something like:
Alias /cgi-bin/linkName /usr/lib/cgi-bin
<Directory /usr/lib/cgi-bin>
Options +ExecCGI FollowSymLinks
DirectoryIndex disabled
AllowOverride None
Require all granted
# etc..
</Directory>
And maybe (but I'm not sure that it's necessary): sudo chown -R www-data:www-data /usr/lib/cgi-bin
.
If you make Alias /cgi-bin/linkName /usr/lib/cgi-bin
you do not need to make a symbolic link.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加