How to run c programmes in browser using apache2 in ubuntu 14.04 ?

  • Posted September 5, 2014

Hi, I am basically from electronics background, but i have got interest in programing for web application, i am very new to it. Find very interesting and moreover i am enjoying it. I installed apache2 on ubuntu, i hosted some virtual host sites with index.html files. but i want to run c programme on browser. i went through cgi configuration for apache2, but was not successful. when i try for any /home/*/public_html/cgi-bin/ for DocumentRoot. apache2 gives DocumentRoot not found error, and get 403 and 404 error when try to access on browser. So how to run c executable file on browser using apache2 in ubuntu 14.04.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

To enable cgi-bin run:

sudo a2enmod cgi
sudo service apache2 restart

Then copy your executable to the directory /usr/lib/cgi-bin/ Assuming the name of your program is hello.cgi it will now be available at http://your.ip.address/cgi-bin/hello.cgi