View Single Post
  #1  
Old 21st July 2012, 18:18
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 60 Times in 44 Posts
Default 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
Reply With Quote
Sponsored Links