DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Ahmad Adillaumam
Ahmad Adillaumam

Posted on

Apache setup for C++ .cgi (Ubuntu)

Enable CGI module

$ sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/
Enter fullscreen mode Exit fullscreen mode

Add this configuration inside <Directory /var/www/> on /etc/apache2/apache2.conf

<Directory /var/www/>
  Options +ExecCGI
  AddHandler cgi-script .cgi
</Directory>
Enter fullscreen mode Exit fullscreen mode

Restart Apache2

$ systemctl restart apache2
Enter fullscreen mode Exit fullscreen mode

Compile your cpp file and put to /var/www/html/

$ sudo g++ FILENAME.cpp -o /var/www/html/FILENAME.cgi
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

πŸ‘‹ Hey, my name is Noah and I’m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, I’d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: