|
#151
|
|||
|
|||
|
Thread has helped me out, tons.
Thanks OP. Saved me a lot of headaches. |
|
#152
|
||||
|
||||
|
Okay, for all of you out there who may be ROR beginners like I am I will take you through the process of how I finally got my application to start working on a HG shared server.
If you're reading this you probably already solved the first problem I ran into which was installation... The guide at the beginning of this forum post solved everything there except for the .htaccess file (described in step 5) which didn't exist. So under "demoapp/public/" you need to create a .htaccess file with the following info: Code:
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]
# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
# RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
RewriteEngine On
# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
# ErrorDocument 500 /500.html
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
However, if you start trying to access controllers etc.. They wont work, or at least they didn't for me. Well, this was because my app was still set up for sqllite3 so you need to create a mysql database and follow the instructions given by DarkGamer: Quote:
Code:
development: adapter: mysql database: name_name username: username_username password: ###### socket: /tmp/mysql.sock # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: mysql database: name_name username: username_username password: ###### socket: /tmp/mysql.sock production: adapter: mysql database: name_name username: username_username password: ###### socket: /tmp/mysql.sock to all the previous forum posters who I basically took all this information from.
|
|
#153
|
|||
|
|||
|
I just noticed that my shared account has rails 2.1.2 installed... How about everyone else?
|
|
#154
|
|||
|
|||
|
Hello deggertsen,
I need your help starting my demoapp, I followed everything from the beginning also I created .htaccess as you explained but I still receive page not found 404 error. I access the app. using the ip address: http://74.52.117.210/rails/ I want to build my first facebook app. and want to make sure everything work fine on gator servers. Also, if you have any more help please tell me about to build my facebook app. ![]() Regards,, |
|
#155
|
||||
|
||||
|
Ayyash,
My guess is that you're not putting in the correct path... If you are on a shared server with HG then, from my understanding, you will need to have something like "http://yourserverip/~username/rails/". I could be wrong and if so I would simply contact HG support for them to help you on that. I'm guessing that it doesn't have anything to do with how you setup Rails. Good luck.
|
|
#156
|
|||
|
|||
|
Hello deggertsen,
At last I managed to run and view my demoapp, I built another demo app called mycity with the same steps but now when I enter my new app address as follow: http://www.ayyash.info/mycity/ the site forward to http://ayyash.info/rails/ could you help? |
|
#157
|
||||
|
||||
|
Have you checked to make sure that you don't have a forwarder on the mycity link? When you put in "ln -s ../demoapp/public rails" I assume that you changed "demoapp" with "mycity" and "rails" with "mycity". So I would go ahead and delete the "mycity" directory that you created under "public_html" and run that command again.
Code:
ln -s ../mycity/public mycity |
|
#158
|
|||
|
|||
|
|
|
#159
|
||||
|
||||
|
Beats me... Submit a support ticket to HG and let me know what they tell you.
|
|
#160
|
|||
|
|||
|
Hello,
This from HG support: The reason this is occurring is because you have rewrite rules setup to match any request URI that isn't /rails to forward to /rails as described by your .htaccess : [root@gator565 /home/bashar/public_html]# cat .htaccess RewriteEngine On RewriteCond %{REQUEST_URI} !^/rails RewriteCond %{HTTP_HOST} ^(www\.)?ayyash.info [nc] RewriteRule ^(.*)$ http://ayyash.info/rails/ [r=301,nc] |
|
#161
|
||||
|
||||
|
That makes a lot of sense... Should have thought of it before. Did you get the changes complete that you needed to get it to work?
|
|
#162
|
|||
|
|||
|
Yes bro. everything worked fine with me, thanx or your help
|
|
#163
|
|||
|
|||
|
Ok, this is very frustrating. The main reason I signed up for HG was because of Rails support. After working on this for a day and a half I still can't get the simple app that works fine on my local system to run on HG.
I believe this is a routing / configuration issue with the web server. I have tried to follow the instructions listed in the forum with no success. Any help would be appreciated. http://dencity.biz/contact is the base app link and the only action I have is list which is http://dencity.biz/contact/list DJ |
|
#164
|
||||
|
||||
|
You haven't told us what the problem is. Saying that something isn't working doesn't give anybody a clue what you have done, are trying to achieve or if for example there is error.
__________________
- David |
|
#165
|
|||
|
|||
|
Hello,
My first attempt to get rails website running on my shared server. Pretty impressed to see rails (version 2.2.2) and ruby (1.8.7) already installed. Quote:
Will soon send a ticket but thought of checking it on the forum too. Thanks |
|
#166
|
|||
|
|||
|
Good day,
How can i use rake db:migrate and rake db:create? Because every run the command i always get /usr/bin/rake:17: undefined method `require_gem' for main:Object (NoMethodError) Ginad |
|
#167
|
|||
|
|||
|
I was able to get the Rails welcome screen following the various steps mentioned in this thread, but when I upload my application to overwrite the default Rails stuff, I get...
Forbidden You don't have permission to access /rails/ on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.aaaaa.org Port 80 I've updated my environment to use production mode, uploaded my routes.rb file, and rand the db migrations after configuring for mySQL. Any suggestions on what's going on? Also, I think I'm still running in development mode, since the db:migrate populated the database defined for development in my database.yml. I thought changing that line in environment.rb would switch this to production. Is there something else? |
|
#168
|
|||
|
|||
|
I am also getting similar problem, how did you solve it
Quote:
|
|
#169
|
|||
|
|||
|
Ive filany made my 1st rails project to work, Ive used cpanel to run app and is working fine by now you can see on www.3den.org
the solution is to create a project and subdomain using cpanel, there you need to create a rewrite to link the rails App to the Subdomain now the problem is that the public/.htaccess is not created, so it try to use fcgi which is buged, you just need to create it by hand and just write: # public/.htaccess RewriteRule ^(.*)$ dispatch.cgi [QSA,L] now your app shall work, hope you find this usefull and admin add sonner as possible suport to fastCGI, there is a very important gem missing http://gemsonrails.rubyforge.org/ with this we can install gems on aplication scope only. is safe and easy hope admin add this cause it will help a loot |
|
#170
|
|||
|
|||
|
I have problem to run the demo application I followed this link
http://forums.hostgator.com/ruby-rai...rt-t13038.html When I try to browse the site it gives the following error htttp://domain/rails/ 404 Not Found The server can not find the requested page: htttp://domain/rails/ |
|
#171
|
|||
|
|||
|
Has anyone successfully deployed more than one Rails app to their server? I have one running currently and want to add a second (running under a different domain name) and am not sure how to go about it.
|
|
#172
|
||||
|
||||
|
I don't have access to my database , can some one help with this issue..
|
|
#173
|
|||
|
|||
|
please post a latest guide on how to deploy RoR application locally develop and deploy on the hostgator server
|
|
#174
|
|||
|
|||
|
For the better understanding we will assume the following:
1) My hostgator user name its "white" 2) I want to create an application called "demoapp" 3) I will organize all my ruby projects inside this directorie /home/white/rubys/, remember that white is my user name 4)Comentaries in the commands will be after # symbol ================================================ I have problems to deploy my locally developed application. Then with the help of hostgator support i finally have my application runing. (Sorry, my english it's very bad but i want to help). So first of all it's better to create the application from scratch using a ssh cliente(for this you can use putty). After connect to the server using putty, you will be situated at /home/white/, then you have to run this commands: mkdir rubys #This is the directory that will contain my ruby on rails applications cd rubys #This located you inside rubys directorie rails demoapp -d mysql #This create the demoapp application Then locate inside the directorie created for the application: cd demoapp Then of that you must create your databse using the CPANEL(not use rake db:create or similars), then create the user. Then and associate the user with the databse created with all the privilegies, do all this things with the CPANEL, it's intuitive. Then as you will see the user created will be {hostgatorUser}_name. So if your hostgator user is "white" and you create a mysql user called "monkey" the user created will be white_monkey. The same happens with the database, so if you created a databse called "db" the database created will be white_db. So knowing this you must configure your database.yml. This file it's located at /home/white/demoapp/config/ . Put the correct user and password for development environment. So if you want to create the database using "rake db:create" it wont work because to create the database you need a user and the user was created just a few minutes ago and that user have all the privileges over the data base created above but doesn't have privileges to create a db so rake db:create or similars doesn't work. Then using "gFTP" you can pass your controllers, views and models. Be carefully at the moment of pass the controllers and views. Pass only that you create, don't pass another file created automatically at the moment of create the application.Read this considerations: 1)Controllers: Inside the controlles directorie it's automatically created an application_controller.rb with the version of rails that i use, but with the version of hostgator the file name is application.rb. So you must pass only controller that you create, because when you run the command "rails demoapp" you don't need to pass application_controller.rb or application.rb files that was created automatically and with the correct configuration. 2) With the models ther are not problems i think you cauld pass the complete folder without problems. 3) With views you must only pass that directories(or folders) associated to any controllers don't overwrite the layouts for example. 4) Inside demoapp/db: Pass the migrate folder located at appname/db. Just pass that folder don't pass the schema.rb file. That file it's created automatically when you run rake db:migrate later. Whit this you probably pass all your sources, it doesn't take much time. So then you must run: rake db:migrate #This will create your table structures in your database. We are almost ready. you must run this commands: cd /home/white/public_html #That its the directorie of your actual site ln -s ../rubys/demoapp/public demo #With this you create a link to your public folder of your application, so when you enter www.yourdomain/demo you will se the welcome page of rails. But we need to do a pair of steps before to open that url with your browser. (remeber that my application its inside rubys directori, analyze the command) Create a file called .htaccess in your computer (somewhere), inside it put the text attached in the file text.txt(at the end you can find the link to download). Then usin gFTP pass .htaccess created before in the public directorie of our demoapp application, the path is /home/white/rubys/demoapp/public remember the assumptions things at the begining of the message. Then of that we must modified the next file /home/white/rubys/demoapp/config/environment.rb , after this line # ENV['RAILS_ENV'] ||= 'production', about the line 5, put this ENV['RAILS_RELATIVE_URL_ROOT']="/demo", so you have: # ENV['RAILS_ENV'] ||= 'production' ENV['RAILS_RELATIVE_URL_ROOT']="/demo" Remember when we create the link we put demo at the end of the command(ln -s ../rubys/demoapp/public demo), that's the reason why the root must be /demo to match the link. With this we are ready, you can open the url www.mydomain/demo with your browser and you'll see the welcome page. if you have a controller called test_contoller you can se it with this www.mydomain/demo/test . ################################################## ########### Something more, i read that the production environment is faster so when you want to pass to the production environment you must create first the database for production and associate it to a user, then configure your database.yml, run rake db:migrate ENV="production" # This create the structure database on production. Then remember the line: # ENV['RAILS_ENV'] ||= 'production' This line it's inside /home/white/rubys/demoapp/config/environment.rb file, uncomment it so it must be: ENV['RAILS_ENV'] ||= 'production' Whit this you are operating in the production environment. I hope this help you, if you have a problem open a ticket and the hostgator support will help you extremely fast. That's all folks. I'm tired .Johao R. LLamoca Palomino. Last edited by jllamoca; 05-25-2009 at 09:16 PM. |
|
#175
|
|||
|
|||
|
Great work jllamoca. Helped me out for sure.
Alternatively, if you don't like /demo on www.domain.com/demo you could delete public_html (back it up!) then from /home/username/ run Code:
ln -s rubys/demoapp/public_html public_html |
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -6. The time now is 04:08 AM.




to all the previous forum posters who I basically took all this information from.
Good luck.

.



