Reputation: 493
I am trying to launch my own mediawiki site and I am having some trouble with the math extension mimetex. In order to enable math equations to display properly on the site you need a .cgi-file working in the background. I compiled the mimetex-cgi file and put it in a folder I made in my mediawiki directory (/etc/mediawiki/cgi-bin). The file is called mimetex.cgi.
However, when I navigate to the file on my webserver it does not generate the image I want (which it is supposed to do), instead it asks me to download the file.
I'm pretty sure the file works properly since I was able to run it on my server. My guess is that I should enable something in apache but I don't know what. I looked at this question and tried the answer here but it didn't work (Apache 403 error (Forbidden) on windows). I entered the Directory-snippet to my apache2.conf but it did not work.
Does anyone know how to enable the running of .cgi-files through a webbrowser?
EDIT: This is what I wrote in my apache-config (/etc/apache2/apache2.conf)
<Directory /etc/mediawiki/cgi-bin/>
AddHandler cgi-script .cgi .pl
Options FollowSymLinks +ExecCGI
AllowOverride None
</Directory>
EDIT2: New problem Added this to config:
<Directory /etc/mediawiki/cgi-bin/>
AddHandler cgi-script .cgi .pl
Options FollowSymLinks +ExecCGI
AllowOverride None
</Directory>
AddHandler cgi-script .cgi .pl
It seems like it recognizes that the user wants to run the file. Now I have this problem instead:
You don't have permission to access /mediawiki/cgi-bin/mimetex.cgi on this server.
EDIT3:What my permissions are
$ls -l /etc/mediawiki/cgi-bin/
-rwxrwxrwx 1 www-data www-data 1359104 Jan 9 01:24 mimetex.cgi
$ls -ld /etc/mediawiki/cgi-bin/
drwxrwxrwx 2 www-data www-data 4096 Jan 9 01:43 /etc/mediawiki/cgi-bin/
My user is: www-data from what I can tell.
Upvotes: 0
Views: 1122
Reputation: 493
Finally solved it!
1.Moved my cgi-file (mimetex.cgi) to /usr/lib/cgi-bin/
2.Changed apache2.conf to:
<Directory /usr/lib/cgi-bin/>
AddHandler cgi-script .cgi .pl
Options +FollowSymLinks +ExecCGI
AllowOverride None
</Directory>
AddHandler cgi-script .cgi .pl
3.Changed the /etc/apache2/sites-enabled/000-default file to:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
4.Did chmod 755
$sudo chmod 755 /usr/lib/cgi-bin
$sudo chmod 755 /usr/lib/cgi-bin/mimetex.cgi
Upvotes: 1