0

I have LAMP installed on Ubuntu 14.04.1.

I want to be able to run cgi scripts from all directories that are within my website. So I added this to /etc/apache2/apache.conf

    <Directory /var/www/> 
          AddHandler cgi-script .cgi .pl
          Options FollowSymLinks +ExecCGI
    </Directory>

I also did this edit in /etc/apache2/mods-enabled/mime.conf

    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    AddHandler cgi-script .cgi .py .pl

But now when i visit my script it says

You don't have permission to access /hello.pl on this server.

But I have chmodded and chowned the script.. in fact look...

ls -la hello.cgi -rwxrwxrwx 1 www-data www-data 84 Jan 26 03:19 hello.pl

ThisSuitIsBlackNot
  • 23,492
  • 9
  • 63
  • 110
Banned_User
  • 973
  • 2
  • 9
  • 17
  • You might want to define *everywhere* and depending on your answer, be prepared to receive a lot of people warning about security. Also, did you try restarting your Apache server? – vol7ron Jan 26 '15 at 02:03
  • All directories and yes i have. – Banned_User Jan 26 '15 at 02:29
  • I also have tried to put it under `` but it wont work. – Banned_User Jan 26 '15 at 02:33
  • Yes I see, its working in cgi-bin, but my question is how to allow it in all directories. When i read through the documentation it says i just need to add the `AddHandler cgi-script .cgi` in `mime.conf` but its not working. – Banned_User Jan 26 '15 at 02:35

1 Answers1

0

(Self answer by Banned_User moved from question body)

What I did was edit /etc/apache2/sites-enabled/www.example.com/ and add:

<Directory /var/www/www.example.com>
      Options +ExecCGI
</Directory>
Community
  • 1
  • 1
ThisSuitIsBlackNot
  • 23,492
  • 9
  • 63
  • 110