I am trying to deploy my RoR application in Bluehost but I´m having some trouble. I want my Rails application to be accessible from a top-level domain, that is to be access once someone access my website URL. I have followed several tutorials, and tried several approaches, but I´m still getting no where. When I access my URL (http://hotelelcidacapulco.com/) I get the following message: No such file or directory - config.ru
I assume it must be a problem of the Symlink. I´ve tried different symlinks however I think it should be:
ln -s ~/path/appName/public appname so something like this:
ln -s ~/rails_apps/ElCid/public ElCid
But I get again the error message message: No such file or directory - config.ru
Again, I´m deffinitely no expert but I assume it has something to do with the symlink. I´ve been struggling a lot, and would really appreciate the help as I need to get it runnning as soon as possible.
Here are my files:
/home3/hotelelc/public_html/.htaccess File:
SetEnv GEM_HOME /home3/hotelelc/ruby/gems
<IfModule mod_passenger.c>
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
RailsEnv production
RackBaseURI /
SetEnv GEM_HOME /home3/hotelelc/ruby/gems
</IfModule>
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)/!$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "Application error Application failed to start properly"
/home3/hotelelc/.bashrc File:
export HPATH=/home3/hotelelc/
export GEM_HOME=$HPATH/ruby/gemsexport GEM_HOME=$HPATH/ruby/gems
export GEM_PATH=$GEM_HOME:/usr/lib64/ruby/gems/1.8
export GEM_CACHE=$GEM_HOME/cache
export PATH=$PATH:$HPATH/ruby/gems/bin
export PATH=$PATH:$HPATH/ruby/gems
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
Finally, this is my /config/environment.rb File:
require File.expand_path('../application', __FILE__)
ElCid::Application.initialize!
ENV['GEM_PATH'] = '/home3/hotelelc/ruby/gems:/usr/lib64/ruby/gems/1.8'
Try moving your .htaccess file to the public directory of your app instead of public_html. I believe this will be app/public/.htaccess. Hope it helps!
Yeah I know this is an old question, but for future readers.
Related
I have pushed my laravel 5.1 application to server. In localhost, it works properly. but in server , only the home page is coming, no other routes working. I get 404 not found not found error. jQuery-2.1.4.min.js:4 POST http://mydomainurl/login/validate_login 404 . I feel, it should traverse to http://mydomainurl/applicationName/login/validate_login. I dont know whats happening and where i have to update.
I have enabled mode rewrite in apache and my .htaccess of application's public/ directory is as below
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteCond %{REQUEST_URI} !^ RewriteRule ^(.*)$ /$1 [L] </IfModule>
I dont know much about .htaccess, but i copied from someone's answer. Please help
After doing all the above modifications,And surfing around net, it didnt work. Finally i understood that it may be because of url problem and just changed the url in ajax, like url: "<?php echo url();?>/login/validate_login", It started working amazingly. Only in local host simply, url: "login/validate_login", works.
Over all, things to be done are:
1: move public folder contents to your server's root folder(name it anything, eg: var/www/html/my_public). Update the .htaccess and index.php of it as explained in other answers. modify server.php, bootstrap/app.php if still didnt work. use url() with the calls. I achieved with this much :-)
The problem is probably caused by your virtualhost config file. It should have "AllowOverride All" directive^
<VirtualHost *:80>
ServerAdmin youremail#yahoo.com
ServerName yoursite.com
ServerAlias www.yoursite.com
DocumentRoot "/var/www/yoursite.com/public"
<Directory /var/www/yoursite.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I am trying to install an app on a shared server. If i understand properly because i am using a shared server, and that Dreamhost doesn't suppose rails 3.2.8 I must use FCGI, although i am not sure how to install and to make it run properly.
From this tutorial http://wiki.dreamhost.com/Rails_3.
To my understand here what I did,
In dreamhost, activate PHP 5.x.x FastCGI and made sure Phusion Passenger is unchecked
Create an app on my localmachine
Because rails doesn't create a dispatch and access file i create the two following file in my /public folder
dispatch.fcgi
#!/home/username/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
ENV['RAILS_ENV'] ||= 'production'
ENV['HOME'] ||= `echo ~`.strip
ENV['GEM_HOME'] = File.expand_path('~/.rvm/gems/ruby 1.9.3-p327')
ENV['GEM_PATH'] = File.expand_path('~/.rvm/gems/ruby 1.9.3-p327') + ":" +
File.expand_path('~/.rvm/gems/ruby 1.9.3-p327#global')
require 'fcgi'
require File.join(File.dirname(__FILE__), '../config/environment')
class Rack::PathInfoRewriter
def initialize(app)
#app = app
end
def call(env)
env.delete('SCRIPT_NAME')
parts = env['REQUEST_URI'].split('?')
env['PATH_INFO'] = parts[0]
env['QUERY_STRING'] = parts[1].to_s
#app.call(env)
end
end
Then created the file
.htaccess
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
ErrorDocument 500 "Rails application failed to start properly"
Uploaded to a folder and pointed to the public folder in dreamhost
Made sure dispatch.fcgi has 777 for write
ssh and run the following command in the public folder : ./dispatch.fcgi
Crossing my finger but it doesn't work I get the following errors
./dispatch.fcgi: line 1: ENV[RAILS_ENV]: command not found
./dispatch.fcgi: line 1: =: command not found
./dispatch.fcgi: line 2: ENV[HOME]: command not found
./dispatch.fcgi: line 2: =: command not found
./dispatch.fcgi: line 3: syntax error near unexpected token ('
./dispatch.fcgi: line 3:ENV['GEM_HOME'] = File.expand_path('~/.rvm/gems/ruby 1.9.3-p327')'
Doing wrong??? Oh and if i go on the server i get this Rails application failed to start properly
I'm in a simlar boat. Make sure you set your username in the first line. Also the last line of the dispatch.fcgi is missing for the rvm verson. Get the last line from the other dispatch example and set your application name.
Last be sure your environment and databases files are set up properly and you have the required gems such as mysql2, fcgi and therubyracer.
I'm not done solving mine yet, but I will make a blog post once I figure out what is needed.
I unzip and rename wp-config-sample.php => wp-config.php and conffig it.
it is exactly my file (i have no edit)
// Heroku Postgres settings
if (isset($_ENV["DATABASE_URL"])) {
$db = parse_url($_ENV["DATABASE_URL"]);
define("DB_NAME", trim($db["path"],"/"));
define("DB_USER", $db["user"]);
define("DB_PASSWORD", $db["pass"]);
define("DB_HOST", $db["host"]);
} else {
die("Cannot determine database settings from DATABASE_URL\n");
}
Then I create .htaccess (app/.htaccess) and config(i have no edit):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Then I upload it to blog folder on heroku. And try install but it always return eror 404 (I see logs heroku) my link to install:
http://mywebsite.heroku.com/blog/wp-admin/install.php
ActionController::RoutingError (No route matches "/blog/wp-admin/install.php
Please help me install this.
Thanks so much
You can't do this - but not due to Heroku not having PHP - because it does. The Cedar stack added support for PHP Facebook applications but you are able to run Wordpress on them. See http://tjstein.com/2011/09/running-wordpress-on-heroku-and-amazon-rds/
HOWEVER You cannot mix languages in the same Heroku application, eg Rails and PHP - they would need to exist as separate Heroku applications. When the application slug is compiled the language is detected at that point.
I have made an tested an application on my computer and all is working fine (I used only the dev environment via the frontend_dev.php page).
When I deploy this application on the test server, I have the error 400 Bad Request below:
Bad Request
Your browser sent a request that this server could not understand.
I accessed to the website with the normal URL.
I'm using symfony 1.4 with doctrine (no others plugins are involved), wamp 2 (php 5.3, apache 2.0.59).
If I try to access the application with the dev environment, it works.
Try checking if the no_script property on your application setting.yml file. If should be set to False, clear cache and try again
Thank you very much Guiman. You have leaded me to the answer.
The no_script_name property wasn't the origin of the problem. Instead, I have my .htaccess in the web directory which was badly generated (I swear on my pet's head that I haven't edited this file before). Below is the file generated by symfony (the bold attribute isn't working within the code one, look at the last line):
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
And this is the updated one (again, look at the last line):
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ **/myApp/index.php** [QSA,L]
</IfModule>
I don't know what happened but I will check on the symfony website I there are similar issues.
I want to run an instance of wordpress within my rails app. I currently have wordpress files housed in public/wordpress, but I need to configure my .htaccess file to allow both types of requests. How do I do that? currently, .htaccess is:
General Apache options
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)/!$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "Application error Application failed to start properly"
You should start by adding this to the .htaccess in your public folder:
RewriteCond %{REQUEST_URI} ^/wordpress.*
RewriteRule .* - [L]
However, this is not the whole story. You also need to edit /etc/apache2/sites-available/
with this addition (to tell Rails not to process anything in /blog as part of the app):
<Location /wordpress>
PassengerEnabled off
Also in /etc/apache2/apache2.conf you may need to tell Apache to make any directory index (e.g. wordpress/) execute an index.php file if there is one:
DirectoryIndex index.php