Quantcast
Viewing all articles
Browse latest Browse all 10

mod-redmine && mod-passenger: Passenger refuses to load (here: Redmine) after rewrite uri. Where to put RailsBaseURI?

Image may be NSFW.
Clik here to view.
Question

i’ve a working Redmine-instance at /var/lib/redmine. (Redmine configuration is not the issue)

ln -s /var/lib/redmine/public /var/www/redmine
chown -R www-data:www-data /var/www/redmine
echo "RailsBaseURI /redmine" > /etc/apache2/sites-available/redmine
a2ensite redmine
service apache2 restart

Tested with via http://here.comes.my.ip/redmine … works fine for a test.

But i have complacations with my servername to folder mapping (rewrite) and passenger.

Here my default virtualhost (yes – everything in one vhost cause of OneSSLCertPerIP)

<VirtualHost *:80>
ServerAdmin admin@example.de
DocumentRoot /var/www
RewriteEngine onRewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} !^/cgi-bin/# map servername to folders
RewriteCond ${lowercase:%{SERVER_NAME}} ^[a-z0-9_-]+.[a-z]+$
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^([a-z0-9_-]+).([a-z]+)/(.*) /var/www/$2/$1/default/$3 RewriteCond ${lowercase:%{SERVER_NAME}} ^[.a-z0-9_-]+.[a-z0-9_-]+.[a-z]+$
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^([.a-z0-9_-]+).([a-z0-9_-]+).([a-z]+)/(.*) /var/www/$3/$2/v+$1/$4
    <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
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined  
</VirtualHost>

These RewriteRules maps
example.de to /var/www/de/example/default and sub.example.de to /var/www/de/example/v+sub

So well (mapping works) so bad (call of redmine via passenger not):

ln -s /var/lib/redmine/public /var/www/de/example/v+redmine
chown -R www-data:www-data /var/www/de/example/v+redmine
[...]
service apache2 restart

[...] can be replaced with several tries to place RailsBaseURI with different folders for /redmine on different positions in /etc/apache2/sites-available/default

Result: http://redmine.example.de/ – There is just a directory listing instead of redmine.

Additional Info: OS: Ubuntu-server Oneiric

Image may be NSFW.
Clik here to view.
Answer

Ok found a solution, but it’s not very dynamic Image may be NSFW.
Clik here to view.
:(

I added

<Directory /var/www/de/example/v+redmine>
    RailsBaseURI /de/example/v+redmine
    PassengerAppRoot /var/lib/redmine
    Options -MultiViews
</Directory>

mod_rewrite causes a little confusion about executionpaths for passenger.
PassengerAppRoot will fix this. Image may be NSFW.
Clik here to view.
;)

P.S.: Use just ONE way(uri) to reach your application – otherwise links will be messed up.


Viewing all articles
Browse latest Browse all 10

Trending Articles