How to configure Apache2 for Redmine properly?
I've written a how-to including this. While it is about Redmine 1.3.x it should be still relevant for the Apache part.
Full how-to: Redmine stable on Debian stable. Basically, it comes down to this:
-
Install and configure
mod_passenger
in/etc/apache2/mods-available/passenger.conf
:PassengerDefaultUser www-data # Below are some lines to tweak mod-passenger. # This keeps some Ruby processes running, # but the average response time is a lot lower # on low-traffic sites. RailsSpawnMethod smart PassengerPoolIdleTime 3000 RailsAppSpawnerIdleTime 0 PassengerMaxRequests 1000
-
Extend your current main 'site', for example
/etc/apache2/sites-available/mymainsite
:<Directory /var/www/redmine> RailsBaseURI /redmine PassengerResolveSymlinksInDocumentRoot on </Directory>
Create another 'site' and include the same as above, changing the
RailsBaseURI
value to/
.
Related videos on Youtube
Bastian
Updated on September 18, 2022Comments
-
Bastian over 1 year
I have a working Redmine installation on my Debian server, but I don't know how to configure Apache2 properly so that neither the content of the Redmine folder nor the Redmine start page will be displayed as the homepage of my website. Suppose the URL of the website was www.myexample.com.
Current state
- www.myexample.com shows files of
/var/www/redmine
folder - with the symbolic link
/var/www/redmine -> /usr/local/lib/redmine-2.1/public/
Wanted state
- www.myexample.com should be my usual website homepage (e.g. showing index.html)
- www.redmine.myexample.com or www.myexample.com/redmine should show the redmine page
I guess it is just a configuration problem but I cannot figure out the problem. So here are my configuration files. Do you see what I am missing here?
/etc/apache2/httpd.conf
<VirtualHost *:80> ServerName redmine.example.com DocumentRoot /var/www <Directory /var/www> AllowOverride all Options -MultiViews </Directory> </VirtualHost>
/etc/apache2/sites-available/redmine
<VirtualHost *:80> DocumentRoot /var/www/redmine <Directory /var/www/redmine> AllowOverride all Options -MultiViews RailsBaseURI /redmine </Directory> </VirtualHost>
/etc/apache2/sites-available/default
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
After changing any of these files, do I have to restart Apache2 or use a2ensite to activate any of the hosts?
-
Michael Hampton over 11 yearsYes, you have to reload Apache after changing its configuration.
-
Bastian over 11 years@MichaelHampton Well good to know. So any ideas about the general problem?
- www.myexample.com shows files of
-
Bastian over 11 yearsWell I am kind of astonished, but your approach actually works! The redmine page is now available under 'mydomain/redmine' while the standard homepage is available under 'mydomain'! One question though: Do you know how to make the redmine section available under a seperate subdomain 'redmine.mydomain'?
-
gertvdijk over 11 yearsUse regular
VirtualHost
ing directives likeServerName
and include the<Directory>
part as you like. This is out of scope of any Redmine/Ruby application, but basic Apache configuration. -
Bastian over 11 yearsAnother question: I just switched my main directory to
/var/www/main
while keeping/var/www/redmine
and the apache2 configuration as is. Unfortunately I seem to have broken the availability of redmine now, the website does not knowhttp://mydomain/redmine
anymore. Do you know what I have to change?