2

I recently installed Apache2 on Ubuntu and I am trying to configure CGI. I added the following lines in apache2.conf file:

ScriptAlias  /cgi-bin/ /home/router/cgi-bin/

<Directory /home/router/cgi-bin/>
        Options ExecCGI
        AddHandler cgi-script cgi pl
</Directory>

And I saved and restart apache2, but when I type the following in browser:

http://192.168.1.1/cgi-bin/file1.cgi 

I get the following error:

You don't have permission to access /cgi-bin/file1.cgi on this server.
1

You need to enable Apache CGI support with the following commands:

sudo a2enmod cgi
sudo service apache2 restart

You also do not need the AddHandler line as it is, as your .cgi extension is not a .pl file.

I recommend your to do do too:

ScriptAlias /cgi-bin/ /home/router/cgi-bin/

<Directory /home/router/cgi-bin>
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.