Run cgi script from ruby on rails public directory

rails
workspace
ruby
apache

#1

I am trying to run a cgi-script from a ruby on rails workspace but when accessed form browser the script just downloads in lieu of executing.

The script does run from the command line.

I followed this article ‘Running a Python CGI Server’ and reconfigured apache to run cgi scripts then restarted the apache server. The file I edited was located in /etc/apache2/conf-available/serve-cgi-bin.conf. I modified to the following:

    <IfDefine ENABLE_USR_LIB_CGI_BIN>
        ScriptAlias /cgi-bin/ /home/ubuntu/workspace/usurance/public/cgi-bin
        <Directory "/home/ubuntu/workspace/usurance/public/cgi-bin/">
             AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
             AddHandler cgi-script .cgi .py
             Require all granted
        </Directory>
    </IfDefine>

Your help is greatly appreciated.