##// END OF EJS Templates
Updates dispatch.fcgi.example to work with Rails3 and removes CGI handlers....
Jean-Philippe Lang -
r9421:049148855488
parent child
Show More
@@ -1,24 +1,20
1 1 #!/usr/bin/env ruby
2 #
3 # You may specify the path to the FastCGI crash log (a log of unhandled
4 # exceptions which forced the FastCGI instance to exit, great for debugging)
5 # and the number of requests to process before running garbage collection.
6 #
7 # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
8 # and the GC period is nil (turned off). A reasonable number of requests
9 # could range from 10-100 depending on the memory footprint of your app.
10 #
11 # Example:
12 # # Default log path, normal GC behavior.
13 # RailsFCGIHandler.process!
14 #
15 # # Default log path, 50 requests between GC.
16 # RailsFCGIHandler.process! nil, 50
17 #
18 # # Custom log path, normal GC behavior.
19 # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
20 #
21 require File.dirname(__FILE__) + "/../config/environment"
22 require 'fcgi_handler'
23 2
24 RailsFCGIHandler.process!
3 require File.dirname(__FILE__) + '/../config/boot'
4 require File.dirname(__FILE__) + '/../config/environment'
5
6 class Rack::PathInfoRewriter
7 def initialize(app)
8 @app = app
9 end
10
11 def call(env)
12 env.delete('SCRIPT_NAME')
13 parts = env['REQUEST_URI'].split('?')
14 env['PATH_INFO'] = parts[0]
15 env['QUERY_STRING'] = parts[1].to_s
16 @app.call(env)
17 end
18 end
19
20 Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(RedmineApp::Application)
@@ -1,55 +1,49
1 1 # General Apache options
2 2 <IfModule mod_fastcgi.c>
3 3 AddHandler fastcgi-script .fcgi
4 4 </IfModule>
5 5 <IfModule mod_fcgid.c>
6 6 AddHandler fcgid-script .fcgi
7 7 </IfModule>
8 <IfModule mod_cgi.c>
9 AddHandler cgi-script .cgi
10 </IfModule>
11 8 Options +FollowSymLinks +ExecCGI
12 9
13 10 # If you don't want Rails to look in certain directories,
14 11 # use the following rewrite rules so that Apache won't rewrite certain requests
15 12 #
16 13 # Example:
17 14 # RewriteCond %{REQUEST_URI} ^/notrails.*
18 15 # RewriteRule .* - [L]
19 16
20 17 # Redirect all requests not available on the filesystem to Rails
21 18 # By default the cgi dispatcher is used which is very slow
22 19 #
23 20 # For better performance replace the dispatcher with the fastcgi one
24 21 #
25 22 # Example:
26 23 # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
27 24 RewriteEngine On
28 25
29 26 # If your Rails application is accessed via an Alias directive,
30 27 # then you MUST also set the RewriteBase in this htaccess file.
31 28 #
32 29 # Example:
33 30 # Alias /myrailsapp /path/to/myrailsapp/public
34 31 # RewriteBase /myrailsapp
35 32
36 33 RewriteRule ^$ index.html [QSA]
37 34 RewriteRule ^([^.]+)$ $1.html [QSA]
38 35 RewriteCond %{REQUEST_FILENAME} !-f
39 36 <IfModule mod_fastcgi.c>
40 37 RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
41 38 </IfModule>
42 39 <IfModule mod_fcgid.c>
43 40 RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
44 41 </IfModule>
45 <IfModule mod_cgi.c>
46 RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
47 </IfModule>
48 42
49 43 # In case Rails experiences terminal errors
50 44 # Instead of displaying this message you can supply a file here which will be rendered instead
51 45 #
52 46 # Example:
53 47 # ErrorDocument 500 /500.html
54 48
55 49 ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now