Installing redmine under lighttpd/fastcgi
Installing redmine under gentoo was reasonably easy. But dude, the default lightweight server that they have has no https support which is unacceptable if you're going to be having people login. Boo. I set out to install redmine to be served up with lighttpd (since apache can be kind of a PITA).
redmine is written in ruby-on-rails so I needed (I think) fastcgi or some other http plugin to handle running ruby and everything. I may have been able to run it with straight ruby (there is a dispatch.rb file in $REDMINE_ROOT/public but the comments mention severe performance impact). I set "fastcgi" in my USE variable, emerge -uNDv world which (re-)installed a bunch of ruby stuff.
Things that I changed in the redmine config:
# pwd /var/lib/redmine/config basalt config # diff database.yml database.yml.example 10,11c10,15 < adapter: sqlite3 < database: db/production.db --- > adapter: mysql > database: redmine > host: localhost > username: root > password: > encoding: utf8 14,15c18,23 < adapter: sqlite3 < database: db/devel.db --- > adapter: mysql > database: redmine_development > host: localhost > username: root > password: > encoding: utf8 basalt config # diff email.yml email.yml.example 6c6 < address: smtp.uvic.ca --- > address: smtp.example.net 8,9c8,11 < domain: uvic.ca < authentication: none --- > domain: example.net > authentication: :login > user_name: "redmine@example.net" > password: "redmine" 16,17c18,21 < domain: uvic.ca < authentication: none --- > domain: example.net > authentication: :login > user_name: "redmine@example.net" > password: "redmine" basalt config # diff environment.rb environment.rb~ 5c5 < ENV['RAILS_ENV'] ||= 'production' --- > # ENV['RAILS_ENV'] ||= 'production' basalt config #
And (in $REDMINE_HOME/public) I moved dispatch.fcgi.example to dispatch.fcgi
Here is my lighttpd config:
# cat /etc/lighttpd/lighttpd.conf | grep -v "^#" var.basedir = "/var/www/localhost" var.logdir = "/var/log/lighttpd" var.statedir = "/var/lib/lighttpd" server.modules = ( "mod_access", "mod_accesslog", ) include "mime-types.conf" server.username = "lighttpd" server.groupname = "lighttpd" server.document-root = var.basedir + "/htdocs" server.pid-file = "/var/run/lighttpd.pid" server.errorlog = var.logdir + "/error.log" server.indexfiles = ("index.php", "index.html", "index.htm", "default.htm") server.follow-symlink = "enable" server.stat-cache-engine = "fam" static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi") accesslog.filename = var.logdir + "/access.log" url.access-deny = ("~", ".inc") $SERVER["socket"] == "localhost:443" { ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/ssl/basalt.pcic/basalt.pcic.uvic.ca.pem" ssl.ca-file = "/etc/lighttpd/ssl/basalt.pcic/basalt.pcic.uvic.ca.cert" setenv.add-environment = ("HTTPS" => "on" ) } debug.log-request-handling = "disable" $HTTP["host"] == "basalt.pcic.uvic.ca" { server.document-root = "/var/lib/redmine/public/" server.indexfiles = ( "dispatch.fcgi" ) server.error-handler-404 = "/dispatch.fcgi" url.rewrite-once = ( "^/(.*\..+(?!html))$" => "$0", "^/(.*)\.(.*)" => "$0" ) $HTTP["url"] =~ "\.fcgi$" { proxy-core.balancer = "static" proxy-core.allow-x-sendfile = "enable" proxy-core.protocol = "fastcgi" proxy-core.backends = ( "unix:/tmp/redmine-fastcgi.sock" ) proxy-core.max-pool-size = 1 } }
and the fastcgi.conf
# cat mod_fastcgi.conf | grep -v "^#" server.modules += ("mod_fastcgi") fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "/var/run/lighttpd/ruby.socket-1", "bin-path" => "/var/lib/redmine/public/dispatch.fcgi" ) ) )
Finally, I had to create a specific config file to spawn fcgi (though, I'm not sure exactly what that means or why I have to do it). The config is in /etc/conf.d/spawn-fcgi and I made a copy and edited accordingly for redmine. Then in /etc/init.d/ I made a link from spawn-fcgi.redmine to spawn-fcgi (as instructed by the inti script).
# cat /etc/conf.d/spawn-fcgi.redmine | grep -v "^#" FCGI_SOCKET=/var/run/lighttpd/ruby.socket FCGI_ADDRESS=127.0.0.1 FCGI_PROGRAM=/var/lib/redmine/public/dispatch.fcgi FCGI_CHILDREN=1 FCGI_CHROOT= FCGI_CHDIR= FCGI_USER=lighttpd FCGI_GROUP=lighttpd ALLOWED_ENV="PATH"
I think that that's it...
blog comments powered by Disqus