I'm trying to run a simple Ruby app with cPanel (version 116.0.11) on a GoDaddy server.I've read that many of the Ruby related functions got deprecated, but I'm wondering if it's not possible any more or only I'm doing something wrong. Packages like "ruby27-ruby" and "ruby27-mod_passenger" are installed.
I've added an application in Application Manager, put an app.rb file in the application path with this code in it:
require 'socket'server = TCPServer.new 5678while session = server.accept request = session.gets puts request session.print "HTTP/1.1 200\r\n" # 1 session.print "Content-Type: text/html\r\n" # 2 session.print "\r\n" # 3 session.print "Hello world! The time is #{Time.now}" #4 session.closeend
I have full root access to this server and when I run the app from the terminal like ruby app.rb
it runs perfectly, I can access the app via browser on port 5678 but when I try to run it via Application Manager I can only see the empty directory index of Apache.
If anybody could tell me what goes wrong here I would really appreciate it.