0

I'm new to ruby development. I tried to install phusion passenger and integrate it with apache on Ubuntu 14.04.

I completed step 2.3 of this page: https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html

But when I go to a url like http://192.168.0.105/suburl/home.rb, the browser downloads the rb file instead of serving it as a web page.

I'm getting lost in all the instructions. Can anyone suggest what I'm supposed to do next to get my home.rb to simply run which simply has puts "hello world"?

Here's my /etc/apache/sites-enabled/000-default

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I see that passenger.load is also in the mods-enabled directory.

4
  • you need to post configs so we can understand what you have.. its like calling a car mechanic and saying my car won't start can you fix it over the phone?
    – Mike
    Oct 16, 2014 at 13:13
  • HI Mike ok I posted to config files. Does that tell you what you need? I'm running this off localhost at 192.168.0.105 Oct 16, 2014 at 13:38
  • actually, I shouldn'tneed anything to do with nginx right? I made a mistake installing it. Oct 16, 2014 at 13:51
  • ok I deleted the nginx config file Oct 16, 2014 at 13:52

1 Answer 1

1

Typically, when your browser offers you a file for download, that means that webserver doesn't recognize file as dynamic content. It's same with php/python/ruby...

For start keep it simple. Choose either Apache or Nginx to run your passenger module.

If you choose apache, enable Ubuntu Universe repositories, and then run:

apt-get install libapache2-mod-passenger

If on the other hand you choose nginx, you have to install nginx version with built-in support:

apt-get install ruby-passenger

Also, your project has to have at least 3 dirs

/var/www/myproject
/var/www/myproject/public
/var/www/myproject/tmp

and 1 file:

/var/www/myproject/config.ru

You need to set up DocumentRoot to "public" but your code starts to load from config.ru. So, this is example apache Vhost:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/myproject/public

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Take a look at 4.1 from your the document you linked.

2
  • thank you! My issue was I didn't set up the 3 directories that you mentioned along with preparing a proper config.ru! By the way, I have a follow up question that might be more for stack overflow that you probably know how to answer. Will post link shortly. Oct 16, 2014 at 14:37
  • actually nevermind about my follow up, I figured it out Oct 16, 2014 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .