Project

General

Profile

How can i setup multiple redmines under one domain with apache2.2?

Added by Dong Wang over 16 years ago

for example, i have a domain just like http://redmine.xxx.net, i want to setup more than one redmines under this domain which can be accessed by this way: http://redmine.xxx.net/project1, http://redmine.xxx.net/project2, and so on. how can i?


Replies (22)

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer over 16 years ago

Assuming you're using an apache/mongrel set up like the one described in HowTo_run_Redmine_with_a_Mongrel_cluster, use something like this in your apache config should work. Though I haven't tried it myself. Also note that redmine supports multiple projects, so something the urls that you're using don't make a lot of sense. I could understand if you wanted separate redmines per client or something though, so hopefully this helps. There may also be some way to cut down on the duplication, but I'd probably focus on just getting it working first. Good luck!

  Alias /redmine1 /opt/code/redmine1/public
  Alias /redmine2 /opt/code/redmine2/public

  <Directory /opt/code/redmine1/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  <Directory /opt/code/redmine2/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  <Proxy balancer://redmine1_cluster>
    Order allow,deny
    Allow from all
    BalancerMember http://127.0.0.1:8000
    BalancerMember http://127.0.0.1:8001
    BalancerMember http://127.0.0.1:8002
  </Proxy>

  <Proxy balancer://redmine2_cluster>
    Order allow,deny
    Allow from all
    BalancerMember http://127.0.0.1:8003
    BalancerMember http://127.0.0.1:8004
    BalancerMember http://127.0.0.1:8005
  </Proxy>

  <Location /redmine1>
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://redmine1_cluster%{REQUEST_URI} [P,QSA,L]
  </Location>

  <Location /redmine2>
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://redmine2_cluster%{REQUEST_URI} [P,QSA,L]
  </Location>

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Anonymous over 16 years ago

Hi, I'm trying your solution just so I can get my redmine URL to be http://myserver.domain/redmine rather than http://redmine.myserver.domain/ (I don't want to use virtual hosts).

Unfortunately, (and I'm not up on web server config so you'll have to excuse me) it doesn't quite work (as you say it might not). I get access to redmine but no javascript/css files are being loaded. It appears that redmine is assuming that all the files in 'public' are at the root of the server (.e.g. /) and so just requests /javascript/* and /css/*. In the mongrel_cluster how-to, using a virtual host, the document root of the host is set to public.

I guess your 'Alias /redmine' is trying to achieve the same but doesn't appear to. The error I'm getting is [Wed May 28 08:15:16 2008] [error] [client 192.168.5.5] File does not exist: /Library/WebServer/Documents/javascripts, referer: http://myserver.domain/redmine/. I also had to change REQUEST_URI for REQUEST_URL (actually it was a type but REQUEST_URI doesn't work, I get an error from redmine in that case).

(/Library/Webserver/Documents is the document root for the server).

Any ideas how we can fix this?

Thanks

Russell

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer over 16 years ago

Sorry, I forgot to include that you need to configure mongrel to know about the prefix. I ran into the same issue and got around it with:

sudo mongrel_rails cluster::configure --prefix /redmine -e production -p 8000 -N 3 -c /path/to/redmine --user apacheuser --group apachegroup

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Anonymous over 16 years ago

Many thanks Mat, that worked a treat. I have another question that maybe you can help with: I don't bother with a mongrel_cluster, just run mongrel for now, so a proxy_balancer seems overkill. Can I simplify the proxy setting in the httpd.conf for just a single instance? Mine currently is

<Proxy balancer://redmine_cluster>
    Order allow,deny
    Allow from all
    BalancerMember http://127.0.0.1:3000
</Proxy>

<Location /redmine>
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
</Location>

But seems a waste to use a balancer just to forward on to a single port. Is there an easier way?

Cheers

Russell

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer over 16 years ago

I think you can just take the whole proxy section out and alter the RewriteRule like so, but I haven't tried it myself:

<Location /redmine>
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ http://127.0.0.1:3000%{REQUEST_URI} [P,QSA,L]
</Location>

But note that I'm pretty sure a given mongrel can only handle one request at a time. So if you have any more than a couple of users the site could start getting sluggish if you're only using one mongrel.

-Mat

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Anonymous over 16 years ago

Thanks Mat, that works. Does anyone have access to the wiki? I think it would be good to put these 2 methods on there for installation guides along with the current methods.

Cheers

Russell

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Dong Wang over 16 years ago

it works, thanks Mat.
who can document it in wiki? it's usefull.

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer over 16 years ago

I emailed Jean-Philippe Lang. Hopefully he can shed some light on how to submit wiki documentation.

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Anonymous over 16 years ago

Does anyone know if there is a difference between Apache on windows and other OSes? I have this working correctly on OS X 10.5 but on a Windows box with Apache 2.2, I just get permission denied for /redmine. Its as if the rewrite rules are being ignored.

Cheers

Russell

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Thomas Lecavelier over 16 years ago

Have you check file permission for public/ dir? Windows security can be tricky when serving files...

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Anonymous over 16 years ago

Hi Thomas, yes the permissions are correct. Both the mongrel services I've installed, and apache are running as SYSTEM who has full control over the redmine folder (and subfolders). It works fine when I run the service without a prefix and access it directly over port 3000, but not when I put the /redmine prefix in and try the apache rewrite. The error I see in the apache log is

client denied by server configuration: C:/redmine/public/

Cheers

Russell

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Anonymous over 16 years ago

Hi Thomas, I've fixed this finally. Apache-2.2.8 on Windows XP SP2. If I replace

<Location /redmine>
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
</Location>

with

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/redmine(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]

Then it works on windows. Not sure why using the

<Location /redmine>
doesn't work on windows. Hopefully this could be added as an FAQ/HowTo entry for windows.

Cheers

Russell

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Ed Beaty over 16 years ago

I know I'm doing something tragically wrong, and am at my wits' end. My project is called "plx"; if I use the apache config shown below, then try http://redmine/plx, I get "You don't have permission to access /plx/ on this server."

<VirtualHost *>
  ServerAlias redmine
  ServerName redmine.mydomain
  DocumentRoot /home/redmine/

  Alias /plx /home/redmine/plx/public

  <Directory "/home/redmine/plx/public">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  <Proxy balancer://plx_cluster>
    Order allow,deny
    Allow from all
    BalancerMember http://127.0.0.1:9003
    BalancerMember http://127.0.0.1:9004
    BalancerMember http://127.0.0.1:9005
  </Proxy>

 <Location /plx>
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ balancer://plx_cluster{%REQUEST_URI} [P,QSA,L]
  </Location>
</VirtualHost> 

I know that mongrel and redmine is working, because wget http://localhost:9003 on the server returns the Redmine start page. And it's not that Apache doesn't have access to the /home/redmine/plx/public directory, since when I remove the location and alias business and set my DocumentRoot to /home/redmine/plx/public, http://redmine gives the the Redmine start page as well.

Any help would be hugely, really really hugely appreciated.
Thanks in advance for any help!
-Ed

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by jq Wang about 16 years ago

Hi,Dong Wang
I have the same requirment as yours.I have configed apache and redmine according to Mat Schaffers solution.But it not work for me.This is my vhost config:

<VirtualHost *:80>
    Alias /redmine /usr/redmine-0.7.1/public
    <Directory "/usr/redmine-0.7.1/public">
          Options FollowSymLinks
          AllowOverride None
          Order allow,deny
          Allow from all
    </Directory>
    <Proxy balancer://redmine_cluster >
        Order allow,deny
        Allow from all
        BalancerMember http://127.0.0.1:8011
        BalancerMember http://127.0.0.1:8012
    </Proxy>
    <Location /redmine>
        RewriteEngine On
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
    </Location>
</VirtualHost>
This is my mongrel_cluster.yml:
---
user: redmine
cwd: /usr/redmine-0.7.1
log_file: log/mongrel.log
port: "8011" 
environment: production
group: nogroup
pid_file: tmp/pids/mongrel.pid
servers: 2

When i open the url http://www.mydomain.com/redmine, I just get nothing(a blank page).
Can you help me ?
Seemed there are wrong config in apache vhost,because i can open the url http://www.mydomain.com:8011/ and http://www.mydomain.com:8012/ . I know little about apache config,anyone can help ?

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer about 16 years ago

It looks like you're missing:

prefix: /redmine

From your mongrel_cluster.yml. I mentioned that above, but forgot to include it in my original post.

HTH, -Mat

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by jq Wang about 16 years ago

Thanks Mat,I've try the prefix: /redmine,but it makes no change.

I config redmine/apache following this howto . it differ from the config your posted in that it doesnt nest the Rewrite config in a Location directive in vhost. I've try both with no success. Any idea ?

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer about 16 years ago

Actually, that reminds me. I saw an apache instance on another box match RewriteRule against the filesystem path rather than the URL. I didn't take the time to fully try it out. When you move the RewriteRule out of the <Location> you changed it accordingly, right?

I would check the logs on your mongrels. Is the request coming in? And does the URL make sense?

Finally, have you considered passenger? (modrails.com) It's been getting a lot of good press lately.

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by jq Wang about 16 years ago

Hi Mat,I'v fixed it.

The reason is,I have another vhost been configure to work for my tomcat app as following:

<VirtualHost *:80>
    ServerName www1.mydomain.com

    DocumentRoot /usr/tomcat/webapps

    JkMount  /* myapp

    ErrorLog /var/log/apache2/jk-err.log

    <Directory /usr/tomcat/webapps>
        AllowOverride None
        Order Deny,Allow
        Allow from All
    </Directory>
</VirtualHost>

When i config the vhost for my redmine ,i have not add the ServerName directive.I thought it's not important and redmine could be access from http://www1.mydomain.com/redmine (now i know it cannot). after i add the ServerName directive,it works fine. Now i can access my redmine at http://www2.mydomain.com/redmine . my final vhost config is like following:
<VirtualHost *:80>
    ServerName www2.mydomain.com
    Alias /redmine /usr/redmine-0.7.1/public
    <Directory "/usr/redmine-0.7.1/public">
          Options FollowSymLinks
          AllowOverride None
          Order allow,deny
          Allow from all
    </Directory>
    <Proxy balancer://redmine_cluster >
        Order allow,deny
        Allow from all
        BalancerMember http://127.0.0.1:8011
        BalancerMember http://127.0.0.1:8012
    </Proxy>
    <Location /redmine>
        RewriteEngine On
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
    </Location>
</VirtualHost>

I dont understand why.but i'm happy it can works anyway(My most concern is to eliminate the large number port).Many thanks to you,Mat

RE: How can i setup multiple redmines under one domain with apache2.2? - Added by Mat Schaffer about 16 years ago

Ahhh... yeah. Sorry I missed that. The ServerName is definitely important. Glad you got it working :)

    (1-22/22)