Setting up emoncms on remote server alongside existing drupal installation with shared domain

Hi. I have a virtual server with a LAMP stack installed. I'm having problems configuring the Apache server to run Emoncms alongside an existing drupal installation with a shared domain.

1. Firstly I tried using Apache's virtual hosting features and set up emoncms.mydomain.tld, with Emoncms installed in /var/www/emoncms. The site worked well, except that the input stream was broken.

2. I managed to get it working by changing the Default web directory from /var/www/www.mydomain.tld to /var/www. This means that I can access emoncms from http://mydomain.tld/emoncms, and the input stream works. The problem here is that in order to access my website I have to got to http://mydomain.tld/www.mydomain.tld , which is obviously no good.

3. I found out how to tweak the .htaccess file in the root of the drupal site, so that it ignores specific directories. This enabled me to copy emoncms into /var/www/www.mydomain.tls/emoncms (as an ignored sub-directory of the drupal site), and I created a symbollic link from /var/www/emoncms -> /var/www/www.mydomain.tls/emoncms. The site worked well like this, except again the input stream was broken.

4. With emoncms installed in /var/www/emoncms, I created a new 'site' in /etc/apache2/sites-enabled/ called emoncms, with the following first line:

Alias /emoncms /var/www/emoncms

This would seem to be the way to go as http://mydomain.tld/emoncms brings up Emoncms' login page. The problem here is that when I login, the URL in the address bar is http://mydomain.tld/emoncms/user/login, but it actually takes me to the login page for my drupal site .. complete with drupalsite theming :( I'm really confused why this is happening, especially because the emoncms and the drupal aren't even in the same directory.

I'm pretty darned sure this method can work because I copied the emoncms apache2 sites-enabled 'site'  from a squirrelmail 'site', which is working just fine like this. Obviously squirrelmail is doing something that I'm not aware of. 

Anybody else dealt with this issue / got more experience with apache / drupal, and can give me some guidance?
 

Robert Wall's picture

Re: Setting up emoncms on remote server alongside existing drupal installation with shared domain

Have you looked at a RewriteRule in your .htaccess file? I'm no Apache expert, but that seems the way to go. For example, this rule makes a request for the "index" file (any extension) of a website into a request to a PHP page "pages.php" that accepts two parameters (section=  and page=  ) and serves up a dynamically created page - basically like Drupal etc does:

RewriteEngine On
RewriteRule ^index.*$ pages.php?section=index&page=0 [T=application/x-httpd-php]
 

(Don't ask any more questions - that's about the limit of my knowledge!  But Google will find plenty of sources with examples and explanations.)

roblog's picture

Re: Setting up emoncms on remote server alongside existing drupal installation with shared domain

Hi Robert. Thanks for the reply. I'll read up on .htaccess and all that. Have sort of got it working ok at the moment so feeling less aggravated by the problem :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.