Project

General

Profile

Apache rewrite with Mongrels not work

Added by jq Wang over 15 years ago

Hi,

I have the following config of my apache.

<VirtualHost *:80>
    ServerName www.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>
It works fine except that I can only add link in wiki or message with full url even it's a internal path. For example, when i edit a message and want refer to another message in the same forum, I cannot do as
"referTo":beRefered
but only
"referTo":http://www.mydomain.com/redmine/.../beRefered
.

I think there may be some incorrect config in apache rewrite. But I'm not familiar with it.
Can anyone help ?


Replies (4)

RE: Apache rewrite with Mongrels not work - Added by Eric Davis over 15 years ago

Start your mongrels with a prefix. I'm pretty sure this works with a cluster also.

E.g. mongrel_rails --prefix '/redmine'

$ mongrel_rails start -h
Usage: mongrel_rails <command> [options]
..... SNIP .....
        --prefix PATH
                                     URL prefix for Rails app
    -h, --help                       Show this message
        --version                    Show version

Eric

RE: Apache rewrite with Mongrels not work - Added by jq Wang over 15 years ago

Thanks Eric, but it not works with a cluster. Am i got it wrong? i am current using redmine-0.7.1.

The follow is the output:

wjq@eaid:/usr/redmine$ sudo /etc/init.d/redmine start
Starting Redmine Server ...
wjq@eaid:/usr/redmine$ cat console.log 
invalid option: --prefix for command 'cluster::start'
Try cluster::start -h to get help.
wjq@eaid:/usr/redmine$ mongrel_rails cluster::start -h                 
Usage: mongrel_rails <command> [options]
    -C, --config PATH                Path to cluster configuration file
    -v, --verbose                    Print all called commands and output.
        --clean
                                     Remove pid_file if needed before starting
        --only PORT
                                     Port number of cluster member
    -h, --help                       Show this message
        --version                    Show version
wjq@eaid:/usr/redmine$ 

RE: Apache rewrite with Mongrels not work - Added by Eric Davis over 15 years ago

jq Wang wrote:

Thanks Eric, but it not works with a cluster. Am i got it wrong?

Add prefix: '/redmine' to your mongrel_cluster.yml configuration file.

Eric

    (1-4/4)