HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   mod_ruby sending file as download instead of running (http://www.howtoforge.com/forums/showthread.php?t=58024)

MaddinXx 21st July 2012 18:18

mod_ruby sending file as download instead of running
 
Hello everyone

Today I did a quick check if everything on my server is running as it should.

However, Ruby (mod_ruby) doesn't.

Server
Debian Squeeze 64-bit
ISPConfig 3.0.4.6

The problem is, that if you are trying to open a ruby file (ruby.rb e.g.) it prompts you do download instead of running it.

vHost looks like:

Code:

<Directory /var/www/slug.li>
                AllowOverride None
                Order Deny,Allow
                Deny from all
</Directory>

                <VirtualHost *:82>
                        DocumentRoot /var/www/slug.li/web
       
                ServerName slug.li
                ServerAlias www.slug.li
                ServerAdmin admin@rackster-server.ch

                ErrorLog /var/log/ispconfig/httpd/slug.li/error.log

                # Custom error pages
                Alias /error/ /var/www/error/
                <Directory /var/www/error/>
                        Options FollowSymLinks
                        AllowOverride None
                        Order allow,deny
                        allow from all
                </Directory>

                ErrorDocument 400 /error/400.html
                ErrorDocument 401 /error/401.html
                ErrorDocument 403 /error/403.html
                ErrorDocument 404 /error/404.html
                ErrorDocument 405 /error/405.html
                ErrorDocument 500 /error/500.html
                ErrorDocument 502 /error/502.html
                ErrorDocument 503 /error/503.html

                <IfModule mod_ssl.c>
                </IfModule>

                <Directory /var/www/slug.li/web>
                                Options FollowSymLinks
                                AllowOverride All
                                Order allow,deny
                                Allow from all
                                <Files ~ '.php[s3-6]{0,1}$'>
                                                Order allow,deny
                                                Deny from all
                                                Allow from none
                                </Files>
                </Directory>
                <Directory /var/www/clients/client6/web47/web>
                                Options FollowSymLinks
                                AllowOverride All
                                Order allow,deny
                                Allow from all
                                <Files ~ '.php[s3-6]{0,1}$'>
                                                Order allow,deny
                                                Deny from all
                                                Allow from none
                                </Files>
                </Directory>

                <IfModule mod_ruby.c>
                        <Directory /var/www/slug.li/web>
                                Options +ExecCGI
                        </Directory>
                        RubyRequire apache/ruby-run
                        #RubySafeLevel 0
                        <Files *.rb>
                                SetHandler ruby-object
                                RubyHandler Apache::RubyRun.instance
                        </Files>
                        <Files *.rbx>
                                SetHandler ruby-object
                                RubyHandler Apache::RubyRun.instance
                        </Files>
                </IfModule>


                # suexec enabled
                <IfModule mod_suexec.c>
                        SuexecUserGroup web47 client6
                </IfModule>
                # Clear PHP settings of this website
                <FilesMatch "\.ph(p3?|tml)$">
                                SetHandler None
                </FilesMatch>

                RewriteEngine on
                RewriteCond %{HTTP_HOST} ^www.slug.li$ [NC]
                RewriteRule ^(.*)$ http://slug.li$1 [R=301,L]

                # add support for apache mpm_itk
                <IfModule mpm_itk_module>
                        AssignUserId web47 client6
                </IfModule>

                <IfModule mod_dav_fs.c>
                # Do not execute PHP files in webdav directory
                        <Directory /var/www/clients/client6/web47/webdav>
                        <FilesMatch "\.ph(p3?|tml)$">
                                        SetHandler None
                                </FilesMatch>
                        </Directory>
                        DavLockDB /var/www/clients/client6/web47/tmp/DavLock
                        # DO NOT REMOVE THE COMMENTS!
                        # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
      # WEBDAV BEGIN
                        # WEBDAV END
                </IfModule>


</VirtualHost>

In ISPConfig, Ruby and SuEXEC are enabled, nothing else.

You might see that Apache is running on port 82. I'm using nginx in front of apache - but I told nginx to pass all .rb files to apache (and even with access via :82/ruby.rb it doesn't work).

Is their a special version of ruby that must be installed on the server?

I tried with:

- No Ruby (that doesn't make sense at all, or isn't ruby required?)
- Ruby 1.8 (apt-get install ruby)
- Ruby 1.9.1 (apt-get install ruby1.9.1)

Help is appreciated :)

Thanks!
MaddinXx

MaddinXx 22nd July 2012 00:17

Got it working by:

Code:

nano /etc/mime.types
and commenting out:

Code:

#application/x-ruby rb
like described in a tutorial here on HTF.


All times are GMT +2. The time now is 09:29.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.