Apache minimum version for Phusion Passenger - ruby-on-rails

Our current Apache installations are running Apache 2.0. Now we'd like to add some Rails applications and plan to run them on Apache with Phusion Passenger. I've gotten conflicting reports about whether we need to upgrade Apache to 2.2 in order to use Passenger (a consultant I highly respect recommended that; someone from Phusion says 2.0 should be fine.
Anybody running Passenger with Apache 2.0 in production?

I was under the impression that the minimum version for Apache with Passenger was 2.2, but if you head over to their site and look in the Users Guide I'm sure it will say what you need.

i was choose this way. (optional)
im havent using Pasenger when production, i get simple deploy rails now. only create rails app # etc/rails_app/myapp/ and upload all app folder and public to myapp/app. then i just need to unchecklist # environment for production and configurated at database.yml
then i copied public # http/public_html folder
run mongrel -> rewrite 12007 to 80 -> restart mongrel
if u get problem, ur app only apper in index, and get error when link to another page.
only ask to admin host to configur .httaccess
for example like
RewriteEngine on
RewriteCond %{HTTP_HOST} ^myapp.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.myapp.com$
RewriteRule ^.*$ "http\:\/\/127\.0\.0\.1\:12007%{REQUEST_URI}" [P,QSA,L]
or do like railsninja said :)

Since no one seems to have a definitive answer, I'm going to assume that the answer I was given by someone at Phusion is definitive. It's on Google Groups at http://groups.google.com/group/phusion-passenger/browse_thread/thread/789f4f6e8f1c542d.
He states that Apache 2.0 and up should be fine. (As it worked out, we were able to go with Apache 2.2 for this server, so the point was moot for us.)

You don't need 2.2. 2.0 works fine and if it doesn't it's considered a bug. That said 2.2 is probably better than 2.0 so regardless of the minimum supported version you should go for 2.2.

Related

How to disable /cpanel and /webmail etc

What is the best and most secure way to disable /cpanel and /webmail from the end of my website's URL?
I would like to disable them so they can't be accessed that way.
Thanks!
Assuming you have not fully control on your servers I mean to the OS through SSH, according to my assumption the easiest way would be redirect those urls to your home page. What web server do you use ? Nginx, Apache etc. ? If this is apache then what is the version ?
You can find your web server config edit section in Cpanel I'm not sure where it is.
There may be those url configs specified. The clear way would be remove them. But if you couldn't find it add one of the config according to your web sever and version
Apache 2.2
RewriteEngine on
RewriteRule (.*)/cpanel(.*)$ / [R]
RewriteRule (.*)/webmail(.*)$ / [R]
Apache 2.2 Doc
Apache 2.4
AliasMatch "(.*)/cpanel(.*)$" "/"
AliasMatch "(.*)/webmail(.*)$" "/"
Apache 2.4 Doc
Nginx
rewrite (.*)/cpanel(.*)$ / ;
rewrite (.*)/webmail(.*)$ / ;
Nginx Doc

Does Puppet Dashboard work in Ruby Passenger 5?

Has anyone encountered problem of running Puppet Dashboard on Ruby Passenger 5? If yes does it really work with that Passenger version?
I've already setup and configured the necessary files required to run Puppet Dashboard via Passenger. Currently, the Apache test page is shown instead of the dashboard menu. This will not appear if Puppet-Dashboard is run in the lightweight Webrick server.
While scouring most of the installation samples and the manuals on how to install and configure it for Centos 6. I've seen most of them were based on Passenger 3 / 4. I am currently using 5.0.10 as it is used in conjunction with Puppet 3.8.1. One thing certain is that RailsAutoDetect is deprecated in version 5 and that has been commented out.
Below my puppet-dashboard.conf file (the load module has been moved to another file to avoid double-instantiation)
On the logs, the first error reported is that the path of /usr/share/puppet-dashboard/public/reports/upload is not there, so I've created those sub-folders to see if what would be the next error.
The next error in the log file after that is now shown like:
Attempt to serve directory: /usr/share/puppet-dashboard/public/reports/upload/
External node and node terminus option has been commented out as not to disrupt normal puppet run-interval activities during office hours.
PassengerHighPerformance on
PassengerMaxPoolSize 6
PassengerPoolIdleTime 1500
PassengerStatThrottleRate 120
Listen 3000
<VirtualHost *:3000>
ServerName mi-cloud-mgmt-config-01
ServerAlias mi-cloud-mgmt-config-01.mimos.local
RailsBaseURI /
PassengerAppRoot /usr/share/puppet-dashboard/
DocumentRoot /usr/share/puppet-dashboard/public/
# UPDATE THIS TO YOUR FQDN
<Directory /usr/share/puppet-dashboard/public/>
Options None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/dashboard_error.log
LogLevel debug
CustomLog /var/log/httpd/dashboard_access.log combined
ServerSignature Off
</VirtualHost>
Yes I have encountered the same issue. I tried to be clever and use the latest passenger for my Puppet Master as per the Puppet guide... https://docs.puppetlabs.com/guides/passenger.html#install-rackpassenger
But it looks like Dashboard doesn't support Passenger 5.x. Which is fair enough considering Dashboard is basically dead.
I noticed the structure of the directories under the <DocumentRoot> and <Directory> were different for Dashboard compared to Puppet Master, namely no config.ru being present.
So on CentOS 6 I tried the version of mod_passenger from EPEL repo mod_passenger-3.0.21-11.el6 and that worked for both Puppet Master and Dashboard.
According to some knowledgeable folks in #puppet IRC there should only be a minor lowering in performance with 3.x compared to 5.x.
Although it might need some tweaking it does work on passenger 5.
I use Nginx but if it works using Nginx it should on apache as well.
I use passenger-5.0.13 with ruby 1.9.1 to run puppet dashboard.

Run two different Rails application on one dedicated server

I have one dedicated server with below configurations
i3 - Dual Core - 3.06Ghz H/T
16GB RAM
500GB SATA2
Now I want to execute two different Rails application on one dedicated server. A both application are different but they are using common database.
Is it possible to do that? If yes – How can I do that?
Is Phusion Passenger with Apache a good approach? If yes - How can I configure two application with one Phusion Passenger server?
I will describe how I run multiple Rails applications on one Linux server, using Apache, Phusion Passenger, and some version of Ruby. You have many choices, but this should help you get started. Many of these details come from the installation script
First, install Phusion Passenger.
> gem install passenger
Second, build the Apache 2 Passenger module. You should be able to execute the following script installed during step one.
> passenger-install-apache2-module
This script will compile the Apache 2 module and explain how to configure Apache. If dependencies are missing the script should offer some helpful advice about how to install them.
Third, edit your Apache configuration file. I have to add something like this. (Just use this for references and don't worry about .rvm) The script run in step two will give you something that you can copy and paste.
LoadModule passenger_module /Users/me/.rvm/gems/ree/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /Users/me/.rvm/gems/ree/gems/passenger-3.0.9
PassengerRuby /Users/me/.rvm/wrappers/ree/ruby
Fourth, add something like this to your Apache configuration file for each application you want to run.
<VirtualHost *:80>
ServerName app1.example.com
DocumentRoot /somewhere/app1/public # <-- be sure to point to 'public'!
<Directory /somewhere/app1/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>
If you have two Rails application sharing one database then they will both have similar connection information in config/database.yml
Yes, It's definitely possible. I've never done it with Passenger + Apache, but I'm sure thats a fine way. I've only ever done it with thin + nginx.
Passenger Phusion with Apache is a solid approach. The fact that they are using the same database shouldn't be a problem (just make sure they don't step on each other in any way).
Generally, just set things up as normal, but take a look at Apache name-based virtual hosts:
http://httpd.apache.org/docs/2.2/vhosts/name-based.html

Ruby and Apache

I followed these instructions, installed passenger, but the web page is still not resolving to the ruby app. It just shows the files. Please help!
https://github.com/redbooth/teambox/wiki/installing-on-ubuntu
By "Ruby app", I assume you refer to an app built with Ruby on Rails, the most common Ruby web application framework.
Make sure that you set the web root to the /public directory, your PassengerRoot and PassengerRuby lines are in the right file (bear in mind that you should not copy those, but instead what the installer told you!), and that you included the RailsEnv line in your site's configuration. (If you are on Rails 3, use RackEnv, instead.)
But these are just generic tips for likely issues. It helps if you have some more specific error messages, if any exist...

Redmine doesn't work properly in Apache

I'm trying to get Redmine (a Ruby on Rails app) working. It works fine when started with ruby script/server webrick -e production, however, I'm having trouble getting it working in Apache with Passenger.
Accessing http://example.com/redmine returns the Redmine home page, but clicking any link (or even adding a / to the URL) results in a 404. According to the Rails log, a RoutingError occurs. For example, when opening the projects page: ActionController::RoutingError (No route matches "/projects.html" with {:method=>:get})
The Redmine directory is /var/www/localhost/htapps/redmine. I followed the documentation at http://www.modrails.org/documentation/Users%20guide.html#_deploying_a_ruby_on_rails_application (section 3.2), so there's a symlink at /var/www/localhost/htdocs/redmine pointing to ../htapps/redmine/public, and the Apache configuration contains DocumentRoot /var/www/localhost/htdocs and RailsBaseURI /redmine.
What is causing it to raise these RoutingErrors?
It looks like this issue was actually caused by the default .htaccess included with Redmine.
Redmine's .htaccess rewrites every request to end with .html. Redmine's routes expect .html-less requests.
Setting RewriteEngine to Off solved the issue for me.
http://ptspts.blogspot.com/2009/05/how-to-fix-railsbaseuri-sub-uri-with.html
The manual workaround (according to what is suggested on the pages above) is adding the line below to config/environments/production.rb:
config.action_controller.relative_url_root = '/redmine'
If not deploying to a Sub-URI and deploying using passenger, adding the rule RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] to your public/.htaccess also solves the issue. As that rule is IfModule-ed out in the default .htaccess.
Another option is to delete .htaccess if you're not using it (As an example you may be using it for additional layer authentication with AuthType Digest etc). It is not required when deploying with passenger.
Even if you will manage to run Redmine in suburi, redmine still will have issues.
Some pages won't be parsed and displayed correctly, if displayed at all.
This issue is almost one year old and indicated for next minor release. Btw dozen minor releases came out, but it's not yet fixed. FCGI mode does not support sub-URI.

Resources