问题
I just have my script on my notebook. So is it necessary to install ruby on apache webserver to run it or are there other possibilities?
Thanks a lot!
回答1:
You can probably run the script on your notebook directly.
Try creating an example script like this:
echo "puts 'hello'" > example.rb
ruby example.rb
That should print:
hello
You can run any Ruby code that way.
You can also make the script executable.
Edit example.rb so it reads like this:
 #!/usr/bin/env ruby
 puts 'hello'
Then on the command line, make the script executable:
 chmod +x example.rb
Then run it:
 ./example.rb
If you are building something more like a Rails app, and you want to run it on a remote webserver that runs Apache:
- On the remote webserver, you must install Ruby. I personally like ruby-install better than - rbenvand- rvm.
- Install a web application server. I personally like Passenger for Apache. 
- Configure Apache. The Passenger gem will tell you how to do this. 
- Restart Apache. 
来源:https://stackoverflow.com/questions/27099612/do-i-have-to-install-ruby-on-my-apache-server-to-run-scripts