I have an apache 2.4.46-3 server, which serves out of /srv/http. I have a folder /srv/http/bin with 2 files:
.htacces (mode 644):
AddHandler cgi-script .exe
Options +ExecCGI
main.exe (mode 755): compiled from main.cpp:
#include <iostream>
using namespace std;
int main () {
cout << "Content-type:text/html\r\n\r\n";
cout << "<html>\n";
cout << "<head>\n";
cout << "<title>Hello World - First CGI Program</title>\n";
cout << "</head>\n";
cout << "<body>\n";
cout << "<h2>Hello World! This is my first CGI program</h2>\n";
cout << "</body>\n";
cout << "</html>\n";
return 0;
}
But when I visit the page localhost/bin/main.exe, it offers to download the exe instead of displaying the html. Did I forget to enable something?
edit:
Problem with cgi-bin directory this did NOT solve my issue!
Replacing all instances of exe
with cgi
also did not solve my issue!
Adding
<Directory "/srv/http/bin">
Options +ExecCGI
AddHandler cgi-script cgi pl exe
AllowOverride All
Require all granted
</Directory>
To httpd.conf also did NOT solve the issue! There are no errors in /var/log/httpd/error_log
related to cgis or exes or the /srv/http/bin folder, so what could be going on here?