Topic: How to reroute index.html to rails???

I setup a server on passenger, with my routes sending the base of the url to a controller-action. This works fine when I run the webrick server on my local machine, but in production, nginx is going straight into the public folder and searching for the index, where is not to be found.

How do I get passenger to pay attention to my routes?


Re: How to reroute index.html to rails???

I think that I am experiencing the same issue. My background on Rails is fairly limited, but since upgrading to Rails 3.0.4, I've had issues testing my controller on live server. Webrick works fine, but when I test my application on my server, it gives me the 404 HTML Error.

I'm using a test-live environment on a GoDaddy Virtual Dedicated Server with Plesk Control Panel.

I'll log into the server via ssh. I am able to create the rails application via

rails new depot -d mysql

This will create the application in the ~ directory which contains the httpdocs folder (where the domain points to).

I can create a symbolic link to the application folder

cd httpdocs
ln -s ~/depot/public depot

I can then navigate to and see the Rails default public page.

However, whenever I create a new scaffold

rails generate scaffold Product \ title:string description:text image_url:string price:decimal


rake db:migrate

everything executes successfully. My issue is that I cannot view this on the website. I think that it could have something to do with the routes.rb, but have no clue on how this is suppose to tie in together. Any help would be appreciated!

Re: How to reroute index.html to rails???

How do you 'restart' your application via the GoDaddy Control Panel?

Do you know how GoDaddy is actually deploying your app?  Passenger? Mongrel?

Your adding the Symkink?  Why?  that doesn't seem right!  Was that in some installation instructions?

Shouldn't you redefine your domain to point to httpdocs/depot instead?

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: How to reroute index.html to rails???

Well I figured out the problem after a lot of debugging. Whew! In efforts to hopefully help others, here's what I found in my situation.

When using Plesk to host your website, you will need to make sure that you have all extensions needed available. In my case, I logged into SSH and installed my own version of Ruby, Rails, and Gem. The version of Plesk I was using was 10.0.1, but only came with older versions of Ruby and Rails.

One of the bigger issues I had really didn't have anything to do with my symbolic links or placements of my Ruby on Rails application. It was Plesk's way of setting up the virtual hosts and Apache's interpretation of Ruby on Rails. I installed the Passenger module for Apache which worked well. Everything was working perfectly in the Passenger Server environment, but I kept getting a 404 or 500 error.

Turns out, not only do you need to have the passenger files installed, but you also need to make some modifications to the vhosts files in this virtual environment.

Keep in mind that I am using Plesk 10.0.1 so the third line may vary depending on your version.

[user@domain]# nano /var/www/vhosts/
[user@domain]# nano /var/www/vhosts/

[user@domain]# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain

in the first vhost.conf file, I added a single line ---> RailsBaseURI /blog
in the second vhost.conf file, I added a single line ----> RailsBaseURI /

the first vhost file was pointing to the domain and the vhost file said to use Ruby for the directory.

This blog directory is outside of the web root folder just under /var/www/vhosts/ where as the web root folder is under /var/www/vhosts/ The symbolic link worked perfectly. I did create them as sudo, but chown and chmod them to the correct user with permissions of 755. I did the same for the symbolic link.

Since I am using Plesk, the third line is to rewrite the configuration file for the You will not need to do this again for the subdomain. Also, I reset apache /etc/init.d/httpd restart to make sure that Apache took the new configurations from Plesk.

Towards the end, I still got a few errors. Granted, I'm an idiot... I didn't create my blog_production database. Failsauce... I took me a while since I'm stubborn and didn't check the log files. I eventually did and bingo!

After creating the database. I didn't want to have to recreate the tables so I did

rake db:migrate RAILS_ENV=production

which copied out the tables in my app setup to the production database.

I do apologize if many of you found this information very elementary, but I was rather pleased with myself to have this part of the whole development process out of the way. Not only did I finally get it working but I have also concluded a few items.

1. Virtual Servers suck ass for trying to query more than 2 records. It took 3 seconds to query. Cheap goDaddy hosting works, but is cheap.

2. I learned a lot about Plesk's setup and can appreciate the hard work that has gone into their development.

3. I've learned a lot about Ruby, Rails, and Gem in the process that is very valuable. I feel that these past 4 hours of on/off work has helped me a great deal in the foundation of a new language.