Enable CGI module
$ sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/
Add this configuration inside <Directory /var/www/>
on /etc/apache2/apache2.conf
<Directory /var/www/>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
Restart Apache2
$ systemctl restart apache2
Compile your cpp file and put to /var/www/html/
$ sudo g++ FILENAME.cpp -o /var/www/html/FILENAME.cgi
Top comments (0)