CGI scripts on Apache2 gives 403 forbidden when the CGI are in a linked folder

Gadi Armony

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?

pa4080

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]

編集
0

コメントを追加

0

関連記事

分類Dev

Apache2 redirect to central cgi script

分類Dev

PHP fast-cgi redirect loop apache2

分類Dev

Apache2のCGIスクリプトは、CGIがリンクされたフォルダーにある場合に403を禁止します

分類Dev

Apache VirtualHost 403 Forbidden

分類Dev

PHPfast-cgiリダイレクトループapache2

分類Dev

Wordpress fast-cgi-bin403禁止エラー

分類Dev

fast-cgiの下のlighttpd2とphpは403 "Permissiondenied"を返します

分類Dev

fast-cgiの下のlighttpd2とphpは403 "Permissiondenied"を返します

分類Dev

Apache giving 403 forbidden errors

分類Dev

python3cgiおよびapache2でUnicodeDecodeErrorを修正する方法

分類Dev

HTTP 403 Forbidden when published using Azure

分類Dev

Ruby CGI is unable to continue the downloading process when sending data to Opera

分類Dev

Why is apache not passing Location header from cgi script back to client

分類Dev

JQuery AJAX + C CGI

分類Dev

Python CGI WebServer

分類Dev

python cgi path confusion

分類Dev

CGI POST method is not working

分類Dev

Apache2はシバンに基づいてcgiファイルを実行しません

分類Dev

Python スクリプトが Apache2 の CGI を介して実行されない

分類Dev

複数の「cgi-bin」を利用するようにApache2を設定するために必要な手順

分類Dev

Microsoft Oauth2 403 Forbidden

分類Dev

VB.net HttpWebRequest returns 403 forbidden when ressource is available

分類Dev

403 forbidden error when changing s3 bucket files

分類Dev

Python CGI internal error login.html login.cgi

分類Dev

Manually add parameters in perl cgi

分類Dev

Python CGI replaces my html

分類Dev

Pythonの生のCGI

分類Dev

CGI印刷の問題

分類Dev

Axios GET request to the discord API gives a 403 forbidden response, but works in Postman

Related 関連記事

  1. 1

    Apache2 redirect to central cgi script

  2. 2

    PHP fast-cgi redirect loop apache2

  3. 3

    Apache2のCGIスクリプトは、CGIがリンクされたフォルダーにある場合に403を禁止します

  4. 4

    Apache VirtualHost 403 Forbidden

  5. 5

    PHPfast-cgiリダイレクトループapache2

  6. 6

    Wordpress fast-cgi-bin403禁止エラー

  7. 7

    fast-cgiの下のlighttpd2とphpは403 "Permissiondenied"を返します

  8. 8

    fast-cgiの下のlighttpd2とphpは403 "Permissiondenied"を返します

  9. 9

    Apache giving 403 forbidden errors

  10. 10

    python3cgiおよびapache2でUnicodeDecodeErrorを修正する方法

  11. 11

    HTTP 403 Forbidden when published using Azure

  12. 12

    Ruby CGI is unable to continue the downloading process when sending data to Opera

  13. 13

    Why is apache not passing Location header from cgi script back to client

  14. 14

    JQuery AJAX + C CGI

  15. 15

    Python CGI WebServer

  16. 16

    python cgi path confusion

  17. 17

    CGI POST method is not working

  18. 18

    Apache2はシバンに基づいてcgiファイルを実行しません

  19. 19

    Python スクリプトが Apache2 の CGI を介して実行されない

  20. 20

    複数の「cgi-bin」を利用するようにApache2を設定するために必要な手順

  21. 21

    Microsoft Oauth2 403 Forbidden

  22. 22

    VB.net HttpWebRequest returns 403 forbidden when ressource is available

  23. 23

    403 forbidden error when changing s3 bucket files

  24. 24

    Python CGI internal error login.html login.cgi

  25. 25

    Manually add parameters in perl cgi

  26. 26

    Python CGI replaces my html

  27. 27

    Pythonの生のCGI

  28. 28

    CGI印刷の問題

  29. 29

    Axios GET request to the discord API gives a 403 forbidden response, but works in Postman

ホットタグ

アーカイブ