Rick
Rick

Reputation: 16274

setting up multiple redmine instance with apache/passenger

I'm working on setting up a pair of redmine instances on a single server under apache.

The first worked fine and I have a virtualhost set up for it with the following vhost config:

<VirtualHost *:80>                                                                                        
  ServerName tickets.domain.com                                                                      
  DocumentRoot /var/www/redmine                                                                           
  RailsEnv production                                                                                     
  RailsBaseURI /                                                                                          
  PassengerResolveSymlinksInDocumentRoot on                                                               
</VirtualHost>  

The second I needed to setup as a subdirectory off of the main default site:

Alias /ops/ "/var/www/ops/"                                                                           
<Directory "/var/www/ops/">                                                                           
    RailsEnv ops                                                                                      
    RailsBaseURI /ops                                                                                 
    PassengerResolveSymlinksInDocumentRoot on                                                         
</Directory> 

So server/ops is the url for the second instance.

The trouble I'm having is that when I restart apache, whichever url you hit first seems to "win" and it breaks the other instance of the site. If I hit the /ops url then it loads just fine, but going to tickets. will cause me to get permission denied errors because all of the urls have /ops in them (for the JS and other files)

If I restart apache and hit the tickets. site first, it loads just fine but then I get 404 errors from Redmine on the /ops url.

This is on Ubuntu with a redmine PPA and both /var/www/ops and /var/www/redmine are symlinks to the shared redmine source code with their own environments defined (production and ops).

Any hints on how I can make these two live side by side successfully?

Thanks

Upvotes: 4

Views: 4329

Answers (2)

Heiko Robert
Heiko Robert

Reputation: 2737

passenger distingues configs based on paths. Please take a look into the Ubuntu bug database: Multiple instance of redmine does not work with passenger

create directories for every config:

/var/lib/redmine/*configname*

create symlink from redmine dir:

ln -s /usr/share/redmine /var/lib/redmine/*configname*/passenger

in your apache virtual host you can add alternative PassengerAppRoot:

PassengerAppRoot /var/lib/redmine/*configname*/passenger

Upvotes: 0

noname
noname

Reputation: 26

this is my apache configuration hosting multiple redmine instances (domain.tld/dev1, domain.tld/dev2, ...).

You also have to change :key and :session_path in config/initializers/session_store.rb of each redmine setup.

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
          Servername domain.tld
          ServerAdmin [email protected]
          DefaultInitEnv RAILS_ENV production
          DefaultInitEnv GEM_PATH /var/lib/gems/1.8
          DocumentRoot /var/www/default-ssl
          <Directory /var/www/default-ssl>
            AuthType Basic
            AuthName "secure section"
            AuthUserFile /etc/apache2/htpasswd
            Require valid-user
            Options +FollowSymLinks +ExecCGI
            RewriteEngine On
            RewriteRule ^$ index.html [QSA]
            RewriteRule ^([^.]+)$ $1.html [QSA]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
            ErrorDocument 500 "Application error Rails application failed to start properly"
            AllowOverride None
            Order allow,deny
            allow from all
          </Directory>

          LogLevel warn
          ErrorLog /ssl_error.log
          CustomLog /ssl_access.log combined
          ServerSignature Off
          SSLEngine on
          SSLCertificateFile    /etc/ssl/certs/domain.tld.crt
          SSLCertificateKeyFile /etc/ssl/private/domain.tld.key
          SSLCACertificateFile  /etc/ssl/certs/domain.tld.ca

          <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
          </FilesMatch>
          BrowserMatch "MSIE [2-6]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
          BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

          Alias /dev1 /var/www/default-ssl/dev1/public
          <Directory /var/www/default-ssl/dev1/public>
            PassengerAppRoot /var/www/default-ssl/dev1
            RailsBaseURI /dev1
            Require user user1 user2
          </Directory>

          Alias /dev2 /var/www/default-ssl/dev2/public
          <Directory /var/www/default-ssl/dev2/public>
            PassengerAppRoot /var/www/default-ssl/dev2
            RailsBaseURI /dev2
            Require user user1
          </Directory>

          ...

        </VirtualHost>
        </IfModule>

Upvotes: 1

Related Questions