Project

General

Profile

Help with Development + server folders (apache?)

Added by David Taylor about 12 years ago

I have ia fresh install of the current Turnkey Redmine server (Debian Squeeze 6.0) which appears to have the Docroot set to /var/www/redmine/public. When I connect to http://serveraddress/ Redmine comes up and works great. What I am trying to do is add developmend directories (I have multiple clients) so I can view the current image as http://serveraddress/client1 or http://serveraddress/client2 etc. Apache has an alias command but when I utilise that I can only get either Redmine or the client aliases working. An example of the alias command is 'Alias /client1 /var/www/client1/'. Done this way I get a forbidden error when trying to access the client.

If on the other hand I introduce an additional virtualhost like:
<VirtualHost *:80>
Alias /client1 "/var/www/client1/"
<Directory /var/www/client1/>
AddHandler php5-script .php
AddType text/html .php
Options Indexes FollowSymlinks
DirectoryIndex index.php index.html index.htm
RewriteEngine Off
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

I have access to the client locations but not Redmine. I think this would ne a necessary part of implementing a development server or am I missing something.

My development requirements are for PHP not Ruby btw.


Replies (1)

RE: Help with Development + server folders (apache?) - Added by David Taylor about 12 years ago

I have found the solution after a lot of searching (not on this site). It involves a couple of changes on top of the original sub-uri example. The sub-uri example is for running multiple clients under passenger (Ruby on Rails, etc). If you are trying to run clients with Perl, PHP or other scripting languages this may be your solution. Could somebody re-work this and post it on the Wiki please.

First the DocumentRoot need to be set normally for non-ruby with /etc/apache2/conf/redmine.conf:
@ServerAdmin webmaster@localhost
SetEnv RAILS_ENV development/production # whichever you need
RewriteEngine On # the rewrite rules are moved to the rails block
DocumentRoot /var/www # docroot moved to a normal position
<Directory /var/www>
Options +FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>

RailsBaseURI /rm
<Directory /var/www/redmine/public/>
RewriteRule /$ /index.html [QSA]
RewriteRule ^([
.]+)$ $1.html [QSA]
Options +FollowSymLinks -MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>@

A symbolic link called rm is created in /var/www pointing to /var/www/redmine/public.
eg: ln -s /var/www/redmine/public rm * don't call this redmine as it will conflict with a directory

Also an index.html is saved at the same location redirecting to /rm. An example is:
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
location.replace("http://serveraddress/rm");
</script>
<title></title>
</head>
<body></body>
</html>

Next the client files can be added. eg - /etc/apache2/conf/client1.conf:
<Location /var/www/client1>
PassengerEnabled Off # this turns off rails and it's rewrites
AllowOverride all
</Location>

Now I can connect to http://serveraddress which is redirected to http://serveraddress/rm which is a symlink to redmine and presto.
Also I can connect to http://serveraddress/client1 or http://serveraddress/client1/ and have the php served page for client1.
Any location reference that leaves the PassengerEnabled reference out is likely to run with rails (untested).

    (1-1/1)