HowTo configure Apache to run Redmine » History » Version 5
Brad Mace, 2009-06-16 16:05
Myths section is unclear
1 | 1 | Cyber Sprocket | h1. HowTo configure Apache to run Redmine |
---|---|---|---|
2 | |||
3 | 2 | Cyber Sprocket | {{toc}} |
4 | 1 | Cyber Sprocket | |
5 | 2 | Cyber Sprocket | These notes assume you already have Redmine running via the webrick server and are looking to get Redmine running via your existing Apache installation. Most of the commands assume you are in the root installation directory of redmine, so be sure to change directory there before starting. |
6 | 1 | Cyber Sprocket | |
7 | h2. For CentOS 5 |
||
8 | |||
9 | h3. Assumptions |
||
10 | |||
11 | * OS is CentOS 5 |
||
12 | * Web server is Apache 2 |
||
13 | ** mod_cgi is enabled |
||
14 | ** name based virtual servers are being used |
||
15 | 2 | Cyber Sprocket | ** the web server runs under the user apache, group apache |
16 | 1 | Cyber Sprocket | |
17 | 4 | Cyber Sprocket | h3. Myths |
18 | |||
19 | * You do not need to run mod_fcgid |
||
20 | * You do not need to run mod_fastcgi |
||
21 | * You |
||
22 | 5 | Brad Mace | bq. This sections needs work. I can't tell if these are the myths or the corrections to the myths. |
23 | 4 | Cyber Sprocket | |
24 | 1 | Cyber Sprocket | h3. Basic Steps |
25 | |||
26 | * Install Redmine per the installation instructions and get it running with webrick. |
||
27 | |||
28 | * Kill the webrick session |
||
29 | |||
30 | * Copy the public/dispatch.cgi.example to public/dispatch.cgi |
||
31 | |||
32 | * Edit public/dispatch.cgi to fix the shell script invocation to read: |
||
33 | @#!/usr/local/bin/ruby@ |
||
34 | |||
35 | * Make sure public/dispatch.cgi has execute permissions via: |
||
36 | @# chmod 755 public/dispatch.cgi@ |
||
37 | |||
38 | * Update the config/environment.rb file to force the rails environment to production, simply uncomment this line at the start of the file: |
||
39 | @ENV['RAILS_ENV'] ||= 'production'@ |
||
40 | |||
41 | 3 | Cyber Sprocket | * Add your virtual host entry to the apache configuration file (/etc/httpd/conf/httpd.conf). We installed redmine into the /live/redmine folder on our server. _Note: be sure to point your DocumentRoot to the public sub-folder!_ |
42 | |||
43 | 1 | Cyber Sprocket | <pre> |
44 | <VirtualHost *:80> |
||
45 | ServerName redmine.<YOUR-DOMAIN>.com |
||
46 | ServerAdmin webmaster@<YOUR-DOMAIN>.com |
||
47 | DocumentRoot /live/redmine/public/ |
||
48 | ErrorLog logs/redmine_error_log |
||
49 | |||
50 | <Directory "/live/redmine/public/"> |
||
51 | Options Indexes ExecCGI FollowSymLinks |
||
52 | Order allow,deny |
||
53 | Allow from all |
||
54 | AllowOverride all |
||
55 | </Directory> |
||
56 | </VirtualHost> |
||
57 | </pre> |
||
58 | |||
59 | * Make sure your files, log, tmp, and vendor directories are all accessible (read/write) by user apache, group apache. We did that via a change of ownership: |
||
60 | @# chown -R apache:apache files log tmp vendor@ |
||
61 | |||
62 | |||
63 | 2 | Cyber Sprocket | h3. Error Messages and Resolutions |
64 | 1 | Cyber Sprocket | |
65 | 2 | Cyber Sprocket | * @Rails requires RubyGems >= 0.9.4. Please install RubyGems@ |
66 | Look for rogue versions of ruby binaries. We had an older version in /usr/bin/ruby as well as /usr/local/bin/ruby. |
||
67 | 1 | Cyber Sprocket | |
68 | 2 | Cyber Sprocket | * @Premature script headers@ |
69 | This is the generic "got something before the Content-Type: header in a CGI script" error from Apache. Run dispatch.cgi (see below) and see what comes out BEFORE the Content-Type: directive. |
||
70 | |||
71 | h2. Helpful Commands |
||
72 | |||
73 | * @# which ruby@ |
||
74 | tells you which ruby binary is being run when the fully-qualified-filename has not been specified. |
||
75 | |||
76 | * @# find / -name ruby@ |
||
77 | searches your entire system for any file named ruby, warning: can take a while on large filesystems. |
||
78 | |||
79 | * @# ruby -v@ |
||
80 | tell you what version of ruby you are running by default |
||
81 | |||
82 | * @#public/dispatch.cgi@ |
||
83 | runs the dispatch CGI script. It should spit out HTML that start with @Content-Type: text/html; charset=utf-8@, if ANYTHING precedes the Content-Type text you will get a "premature script headers" error in the Apache log files. |