I've been learning Ruby recently, and I wish to upload an evaluation web application to my server. However I can't learn how to have it to operate on my small hosting that is shared.
My Hosting Particulars
- Hosting That Is Shared with JustHost (see for listing of features)
- OS: Linux
- Apache: 2.2.11
- cPanel: 11.25.-STABLE
- No SSH access.
- Can install Ruby Gems.
- Can't install Apache modules.
- Can "Manage Ruby on Rails Programs" through cPanel.
- Mongrel jewel is installed.
I built the next simple HelloWorld Ruby Rack application using Sinatra:
#!/usr/bin/ruby ruby require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" finish
I simply can can't learn how to "start" the applying. Should i tell Mongrel (or possibly Apache) the application is available in some way? How do you start this application running? I'm pleased to provide more information as needed.
first of all you need to start the application manualy or by script once the server is beginning. Simply do something similar to ruby hi.rb (as referred to on sinatra web page it runs appication around the port 4567). Then you've two options. 1) You have access to this application directly as: http://yourserver:4567/ or 2) you should use apache like a proxy.
If you would like use apache like a proxy you need to use virtualhost servers. for instance:
NameVirtualHost hi.server:80 <VirtualHost hi.server:80> Servername hi.server RewriteEngine On <Proxy balancer://hi> BalancerMember http://127...1:4567 </Proxy> ProxyPass / balancer://hi/ ProxyPassReverse / balancer://hi/ </VirtualHost>
And when you've ie multiple cores you are able to run hi.rb more then once (every time on diferent port) and you simply add new BalancerMember. You may also turn on apache cache using directive: CacheEnable mem /