Part 4: Redmine on Apache
This is Amsterdam Airport Schiphol, closest international airport to Phusion’s office.
I’ll be using How to configure Apache to run Redmine as a source.
Install Apache
yum -y install httpd openssl mod_ssl chkconfig --level 345 httpd on service httpd status
Install Passenger Apache module
yum -y install gcc-c++ curl-devel zlib-devel httpd-devel apr-devel apr-util-devel gem install passenger #ignore "no definition... errors" passenger-install-apache2-module #enter to continue #can safely ignore a variety of errors, as long as you see "The Apache 2 module was successfully installed."
Edit Apache config to include passenger
Find the passenger version directory to use in the httpd.conf below:
find /usr/local/lib/ruby/gems/1.8/gems/ -name mod_passenger.so
Change httpd.conf:
vim /etc/httpd/conf/httpd.conf
Append the following lines to /etc/httpd/conf/httpd.conf
LoadModule passenger_module [PATH TO mod_passenger.so] PassengerRoot [BEGINNING OF PATH TO passenger root like '/usr/local/lib/ruby/gems/1.8/gems/passenger-[VERSION]' no quotes] PassengerRuby /usr/local/bin/ruby PassengerTempDir /tmp/passenger
Configure the ServerName for redmine
vim /etc/httpd/conf/httpd.conf
Append the following to /etc/httpd/conf/httpd.conf:
ServerName SERVERNAME.domain.com #obviously replace the name with IRL name of server
Configure the VHost for redmine
vim /etc/httpd/conf/httpd.conf
According to the Passenger documentation, add the following VHost config to the main Apache config:
<VirtualHost *:80> ServerName SERVERNAME.domain.com DocumentRoot /var/www/redmine/public ErrorLog logs/redmine_error.log <Directory /var/www/redmine/public> Allow from all Options -MultiViews Order allow,deny AllowOverride all </Directory> </VirtualHost>
Change permissions on redmine files to apache:apache
According to the Passenger documentation, permissions need to be adjusted:
chown -R apache:apache /var/www/redmine
Adjust the SELinux policies
Note it might make some sense to just allow SELinux to just tag the files as it would, but I haven’t tested that yet.
Some assistance from Sascha Sanchez
Configure access to a temp directory for passenger
mkdir /tmp/passenger chown -R apache:apache /tmp/passenger chcon -R -h -t httpd_tmpfs_t /tmp/passenger #we'll do it live! >:O setsebool -P httpd_setrlimit 1 #this should take way too long. So be patient. chcon -R -h -t bin_t /usr/local/lib/ruby/gems/1.8/gems/passenger-*/agents/ chcon -h -t httpd_modules_t /usr/local/lib/ruby/gems/1.8/gems/passenger-*/ext/apache2/mod_passenger.so chcon -Rv --type=httpd_sys_content_t /var/www/redmine/
Even if UnionStationSupport is set to off (which is also the default), Passenger tries to create /var/log/passenger-analytics. Not sure why. Passenger won’t work without that directory being present.
mkdir /var/log/passenger-analytics chown apache:apache /var/log/passenger-analytics
Start Apache, test access and the config
service httpd restart
Hit http://server:80 in a browser.
Looks familiar as it’s the same instance of redmine as you accessed, except you can smell that it’s being served much more efficiently, can’t you?