aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-29 18:45:39 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-29 18:45:39 +0000
commit3e73278020107ea7282c45001d82e90d23a708b4 (patch)
treea725371edff1f1eac33259370495a8f76aeb2480
parente8170805df1a32119db9d328daee1239b338ac71 (diff)
downloadrails-3e73278020107ea7282c45001d82e90d23a708b4.tar.gz
rails-3e73278020107ea7282c45001d82e90d23a708b4.tar.bz2
rails-3e73278020107ea7282c45001d82e90d23a708b4.zip
Removed the default .htaccess configuration as there are so many good deployment options now (kept it as an example in README) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9134 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/lib/action_controller/http_authentication.rb2
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/README63
-rw-r--r--railties/Rakefile9
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb5
5 files changed, 58 insertions, 23 deletions
diff --git a/actionpack/lib/action_controller/http_authentication.rb b/actionpack/lib/action_controller/http_authentication.rb
index cd81c24e8b..31db012ef2 100644
--- a/actionpack/lib/action_controller/http_authentication.rb
+++ b/actionpack/lib/action_controller/http_authentication.rb
@@ -70,7 +70,7 @@ module ActionController
#
# On shared hosts, Apache sometimes doesn't pass authentication headers to
# FCGI instances. If your environment matches this description and you cannot
- # authenticate, try this rule in public/.htaccess (replace the plain one):
+ # authenticate, try this rule in your Apache setup:
#
# RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
module Basic
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 97f3b8cf7c..672131b96e 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Removed the default .htaccess configuration as there are so many good deployment options now (kept it as an example in README) [DHH]
+
* config.time_zone accepts TZInfo::Timezone identifiers as well as Rails TimeZone identifiers [Geoff Buesing]
* Rails::Initializer#initialize_time_zone raises an error if value assigned to config.time_zone is not recognized. Rake time zone tasks only require ActiveSupport instead of entire environment [Geoff Buesing]
diff --git a/railties/README b/railties/README
index fec796013d..b5f4eee4b7 100644
--- a/railties/README
+++ b/railties/README
@@ -1,14 +1,14 @@
== Welcome to Rails
-Rails is a web-application and persistence framework that includes everything
-needed to create database-backed web-applications according to the
-Model-View-Control pattern of separation. This pattern splits the view (also
-called the presentation) into "dumb" templates that are primarily responsible
-for inserting pre-built data in between HTML tags. The model contains the
-"smart" domain objects (such as Account, Product, Person, Post) that holds all
-the business logic and knows how to persist themselves to a database. The
-controller handles the incoming requests (such as Save New Account, Update
-Product, Show Post) by manipulating the model and directing data to the view.
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb" templates
+that are primarily responsible for inserting pre-built data in between HTML tags.
+The model contains the "smart" domain objects (such as Account, Product, Person,
+Post) that holds all the business logic and knows how to persist themselves to
+a database. The controller handles the incoming requests (such as Save New Account,
+Update Product, Show Post) by manipulating the model and directing data to the view.
In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
@@ -29,7 +29,6 @@ link:files/vendor/rails/actionpack/README.html.
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
and your application name. Ex: rails myapp
- (If you've downloaded Rails in a complete tgz or zip, this step is already done)
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
4. Follow the guidelines to start developing your application
@@ -62,6 +61,50 @@ Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
+== Apache .htaccess example
+
+# 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.fcgi [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"
+
+
== Debugging Rails
Sometimes your application goes wrong. Fortunately there are a lot of tools that
diff --git a/railties/Rakefile b/railties/Rakefile
index df87cd61a6..ef673c234e 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -160,7 +160,6 @@ end
# Copy Ties Content -----------------------------------------------------------------------
-# :link_apache_config
desc "Make copies of all the default content of ties"
task :copy_ties_content => [
:copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_application,
@@ -197,8 +196,6 @@ task :copy_configs do
cp "configs/routes.rb", "#{PKG_DESTINATION}/config/routes.rb"
- cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
-
cp "configs/initializers/inflections.rb", "#{PKG_DESTINATION}/config/initializers/inflections.rb"
cp "configs/initializers/mime_types.rb", "#{PKG_DESTINATION}/config/initializers/mime_types.rb"
@@ -231,12 +228,6 @@ task :copy_app_doc_readme do
cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
end
-task :link_apache_config do
- chdir(File.join(PKG_DESTINATION, 'config')) {
- ln_s "../public/.htaccess", "apache.conf"
- }
-end
-
def copy_with_rewritten_ruby_path(src_file, dest_file)
ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 28f8ce2149..fc4ac8eb01 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -52,13 +52,12 @@ class AppGenerator < Rails::Generator::Base
m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb"
m.template "helpers/test_helper.rb", "test/test_helper.rb"
- # database.yml and .htaccess
+ # database.yml and routes.rb
m.template "configs/databases/#{options[:db]}.yml", "config/database.yml", :assigns => {
:app_name => @app_name,
:socket => options[:db] == "mysql" ? mysql_socket_location : nil
}
- m.template "configs/routes.rb", "config/routes.rb"
- m.template "configs/apache.conf", "public/.htaccess"
+ m.template "configs/routes.rb", "config/routes.rb"
# Initializers
m.template "configs/initializers/inflections.rb", "config/initializers/inflections.rb"