Site5 - Built For Designers & Developers MENU

Configure Apache to run a plain ruby script?

[2 Grey Star Level]

How would I go about configuring apache for my domain to execute ruby scripts for files starting with #!/usr/bin/ruby

Answer #1

Hello,

I hope this reply finds you well!

There are two methods to do what you are looking for.

First

If it’s just a simply script, you can run the file easily by placing it inside of the cgi-bin folder. Make sure that you have “#!/usr/bin/ruby” (without the quotes) is at the top of the file to make sure that it is run by ruby correctly.

It is also important that you have ‘puts “content-type: text/html”’ (without the single quotes) at the top of the file. Otherwise it will attempt to download the output of the script rather than displaying it in your browser.

In regards to the second method, an article is in the works about how to do this outside of the cgi-bin folder using htaccess. It should be on our KnowledgeBase in the next day or two and I will reply here with a link once it is online.

If you have any questions, please feel free to either leave a comment here, or if you prefer, you can contact our support team directly by opening a ticket through Backstage.

Happy Hosting!

Answers Answered By: joliver [476 Blue Star Level]

Answer #2

Hello again,

I hope you are well!

The article about running ruby scripts through apache without using the cgi-bin is finished. You can find the article at the link below.

http://kb.site5.com/ruby-2/how-to-run-a-ruby-script-using-apache-and-cgi/

If you have any questions, please feel free to leave a comment here, or if you would prefer, you can open a ticket with our support team through Backstage.

Happy Hosting

Answers Answered By: joliver [476 Blue Star Level]

Answer this Question

You must be Logged In to post an Answer.

Not a member yet? Sign Up Now »

Money Back Guarantees
Click to verify BBB accreditation and to see a BBB report.