Rails with Phusion Passenger and Apache

Hello All,

I want to start Rails3 app with apache and passenger but I am not able
to do that. I have followed some links but for me its not working or I
am not getting it properly.
Here the links that I have followed:
http://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger
https://help.ubuntu.com/community/RubyOnRails#Configure_Apache

Can anyone help me to use passenger and apache with rails3?
You can also provide any useful link for that or any tutorial.

Thanks in advance.
Help will be appreciated.

Please give us a little bit more information, doesn’t work is somewhat wage…

What error messages do you get, the show us the bits of your configuration.

Which Version of Ubuntu are you running?

Post anything more I have forgotten

Please give us a little bit more information, doesn't work is somewhat
wage...

Ok

What error messages do you get, the show us the bits of your configuration.

I have created a virtual link for railsapp/public folder virtual
hosting as mentioned in below link.
http://articles.slicehost.com/2009/2/2/ubuntu-intrepid-using-mod_rails-to-serve-your-application

Then it creates domain.com or www.domain.com for rails app. but when I
open this in browser its not working. Look at the image.

According to me, it should shows rails application but its not doing that.

Which Version of Ubuntu are you running?

I am using Ubuntu 12.04, Phusion Passenger Application Server and Apache Server
I just want to know how to start Rails app with passenger and apache
without starting it with Webrick(Default app. server).

Now can you help me?

When you say domain. Com in the apache configuration than only apache is aware of this domain. Firefox just uses the standard way and try to look up that name via DNS. Since it can’t find anything it says that there is nothing. You have to use local host instead or add that domain to your /etc/hosts file.

But only touch hosts when you know what you are doing. In any other case change your apache conference to use local host and use local host in the browser.

But when developing local it is better to use rails s or a passenger standalone and start it via console when needed. You only need to configure mod.rails local when you want to serve an intranet Page. And that you should only do when you know what you are doing again.

But if you insist, I think we can help you to get it running.

When you say domain. Com in the apache configuration than only apache is
aware of this domain. Firefox just uses the standard way and try to look up
that name via DNS. Since it can't find anything it says that there is
nothing. You have to use local host instead or add that domain to your
/etc/hosts file.

<snip>

But if you insist, I think we can help you to get it running.

Yes for helping me :slight_smile:

I want to build a website using RoR and for that I have to start it
for all time and to do that I want to use passenger.
Now what can I do for that?
Or their is another way to start rails app and link it to domain(website).

I have server(which is Linux based) for that work and all I have to do
through console mode. So help me according to that.

Your "problem" has nothing to do with RoR or Passenger; it's that you
apparently don't know how the Internet works.

Please go read something about the Domain Name System (DNS).
Then register a domain name for your project so name servers can
find it.

In the meantime, for your own testing purposes, put the name you
want to use and the server's IP address in your own /etc/hosts file.
(Remove it when your registered domain is in place.)

<snip>>

Please go read something about the Domain Name System (DNS).
Then register a domain name for your project so name servers can
find it.

Ok, Thanks.

In the meantime, for your own testing purposes, put the name you
want to use and the server's IP address in your own /etc/hosts file.
(Remove it when your registered domain is in place.)

I have already buy a domain and server too.

Is that server an Ubuntu too?
If not many things in configuring apache can differ, at least the files are located somewhere else. Also the needed dependencies for passenger will have other package names.

But since it seems that you not really know what you are doing, I really would suggest you that you search someone who knows and pay him some big cks to set everything up. Or else use heroku or another well known rails hosted. You could then use the domain of your server with a redirect to heroku.

Is that server an Ubuntu too?

Yes

If not many things in configuring apache can differ, at least the files are
located somewhere else. Also the needed dependencies for passenger will have
other package names.

But since it seems that you not really know what you are doing, I really
would suggest you that you search someone who knows and pay him some big cks
to set everything up. Or else use heroku or another well known rails hosted.
You could then use the domain of your server with a redirect to heroku.

I don't think Its the right choice to pay someone for doing that. I
will try it and hopefully run that too.
Anyways thanks for your help.

Believe me it is, I had to learn that the hard way a couple of years ago!

Setting up a webserver that it works is one thing, setting it up that
it works AND is secure another thing!

I did some misconfigurations that time and opened a big security hole
in my webserver. No one discovered it in the first place, but about
half a year later, someone used that hole to hack my server and abuse
its processing power for spam mail sending and crawling the web for
more email-addresses. Another problem were the leaked database and its
contents.

Since my hoster realized the high CPU use after a couple of minutes he
shut down that host. I was lucky about that. Since all what happened
was my fault of misconfiguring the server I had to pay fees! But since
the host was shut down very early I wasn't punished for spammail but I
had to pay a fee for the leaked userdata. It summarized to about 2500
€ (about 3000 USD).

Paying someone who knows how to configure such a webserver would have
cost only a fraction, and if I had have a bigger userbase it would
have been much more money!

Don't repeat mistakes that others did. Make your own, but make them different!

<snip>

Don't repeat mistakes that others did. Make your own, but make them different!

Thanks for sharing your experience. I will take care about that.
Although I am a student and learning RoR so I am not able to afford that.
But can i link my site to ipaddress:3000 on which rails app is running?

Although I am a student and learning RoR so I am not able to afford that.

I think you missed the point of that story :slight_smile:

But can i link my site to ipaddress:3000 on which rails app is running?

If you're using Passenger, it should be listening on port 80.

Why would you want people to have to add a port # to the URL of
your site?

<snip>

If you're using Passenger, it should be listening on port 80.

Why would you want people to have to add a port # to the URL of
your site?

Then how can I access site without port. Please give some idea how can
I do this?

I'd imagine it's the default for a Passenger installation, but it's been a
long time since I configured one.

What is not working for you at this point? What *exactly* ?

When your Apache is configured to listen on port 80 AND apache is
configured to serve a certain VirtualHost via Passenger, THEN no port
in the URL is needed.

The documentation of passenger itself is very straight forward. The
only mistakes you can make is to "name" the VirtualHost wrong, set the
Passenger pathes wrong or put the DocumentRoot into a wrong directory.
If you have none of this wrong, everything should work.

Hint 1: All I say now is for PRODUCTION!
Hint 2: ServerName has to be the domain you bought, or any subdomain
that is resolved to the same IP-Address.
Hint 3: RailsEnv shall be production
Hint 4: PassengerRoot and PassengerRuby should point to the root-dirs
in which the appropriate binaries are located.
Hint 5: After changing apache config don't forget to restart it, can
take hours to find that damn mistake, been there, done that…
Hint 6: Remember to touch that file passenger needs to recognize the
updated app and restart it, after you changed something, also an error
that will eat hours of your life…
Hint 7: Last but not least: Learn to use a deploy-tool like Capistrano
or Vlad, it will make many things easier and do things automatically
that I personally would forget with every deploy (see Hint 5 and 6 :slight_smile:
)

When none of these Hints help you, you should learn how to find the
various logs apache provides, there will be questions about their
contents then.

Hello All,

I want to start Rails3 app with apache and passenger

Just to make sure that you really want to do this can you explain why
you want to run with apache and passenger? Please try and explain
exactly what you are trying to achieve.

Colin

<snip>

I want to start Rails3 app with apache and passenger

Just to make sure that you really want to do this can you explain why
you want to run with apache and passenger? Please try and explain
exactly what you are trying to achieve.

I want to design a websile using RoR. So I am able to link domain name
with rails app/public folder. But application does not working as to
run it we have to start it using rails server command then it starts
application at idaddress:3000.

So how can I link my website to that domain?

Do you need the website to be accessible to the global internet or just locally?

Colin

<snip>

Do you need the website to be accessible to the global internet or just locally?

Global Internet.

I told you the necessary steps in a mail above. What exactly is not working?

I had neither Rails nor Passenger experience at all when I sat it up
the first time. I was finished in a couple of minutes.

So please tell us, which steps have you done on your WEBSERVER to get
it up and running, which messages did occur, and what is written to
apaches error log when trying to open your domain? What do you see in
your webbrowser then? Are there any messages in
RAILS_ROOT/log/production.log? What do they say?