Helpful Information
 
 
Category: Ruby & Ruby On Rails
mod_rewrite for Ruby app?

Hi All,
I just installed redMine (http://www.redmine.org/) on a server, and I love it so far. This first go was a test install, once I'm confident that it'll work for us, I'm going to deploy it for my company.

I'd like to clean up the URL. Right now its www.site.com:3000, which isn't very attractive or friendly. I'm new to Ruby, and I've never done a mod_rewrite myself.

Can someone give a pointer or two? I know it possible, but scouring the web hasn't gotten me on the right track yet.

Thanks,
Chris

I've spent a fair amount of time on the web researching this. I now realize that the port number shows because I'm using WEBrick. It looks like mod_rewrite may take care of this for me, but would I be better running the rails app with fcgi?

Thanks,
Chris

Assuming you've got control of the server, getting it to run under mod_ruby will be faster than either fcgi or webrick. If you're not willing to go that far, yeah, fcgi is probably better than webrick (judging from the tiny bit of experience I had with an older version of webrick).

Also you should be able to just change webrick's port to 80 but I'm not into all that rails stuff so I don't know where that particular configuration would be located.

As for mod_rewrite, from the docs (http://httpd.apache.org/docs/2.2/misc/rewriteguide.html):



# For sites running on a port other than 80
RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^/(.*) http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]


edit: although this doesn't remove the :3000 from the visible url it does allow accessing the site without typing it in.










privacy (GDPR)