OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Virtual Hosts and CNAMES for mult. conferences on one host.

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Virtual Hosts and CNAMES for mult. conferences on one host.

Postby bdgregg » Wed Sep 15, 2004 8:50 am

Is this possible?

I have done the following which seems to work although I haven't checked all links, etc. Please advise if this is not a good idea or there is a known issue. I need to know asap.

added to httpd.conf...
Code: Select all
# Virtual Host #1 cname1.domain.com
<VirtualHost cname1.domain.com>
   ServerAdmin user@domain.com
   DocumentRoot /usr/local/apache2/htdocs
   ErrorLog logs/vhost-cname1.error.log
   CustomLog logs/vhost-cname1.access.log combined
   RewriteEngine On
   RewriteRule ^/ocs/(.*) /ocs/$1?cf=1 [L]
</VirtualHost>
# Virtual Host #2 cname2.domain.com
<VirtualHost cname2.domain.com>
   ServerAdmin user@domain.com
   DocumentRoot /usr/local/apache2/htdocs
   ErrorLog logs/vhost-cname2.error.log
   CustomLog logs/vhost-cname2.access.log combined
   RewriteEngine On
   RewriteRule ^/ocs/(.*) /ocs/$1?cf=2 [L]
</VirtualHost>


Thanks,
Brian Gregg.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh

Postby kevin » Wed Sep 15, 2004 12:32 pm

We've never tested such a scenario so I can't say for sure how well it would work.

You will probably need to change the definition of $baseurl in include/common.inc.php to be generated dynamicallying using $_SERVER['HTTP_HOST'].

Also, I don't think your rewrite rules will work correctly if the URL contains a query string. This may not be a concern if you only require the main pages to be accessible without specifying the conference ID.
kevin
 
Posts: 338
Joined: Tue Oct 14, 2003 8:23 pm

Postby bdgregg » Tue Sep 28, 2004 1:58 pm

Kevin,

After a bit of manipulating we came up with what seems to work.
And yes I did have to change the common.inc.php as you suggested.

In the httpd.conf file I had to change a few things.
Code: Select all
ServerName localhost
NameVirtualHost {IP Address of the system}


Then I created the VirtualHost entries:
Code: Select all
# Main Site Host 1
<VirtualHost xxx.xxx.xxx.xxx>
     ServerName conferences.isp.com
     ServerAdmin contact@isp.com
     DocumentRoot /usr/local/apache2/htdocs
     ErrorLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/error.log"
     CustomLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/access.log" combined
     RewriteEngine On
     RewriteMap lowercase int:tolower
     RewriteCond %{REQUEST_URI} ^/static/
     RewriteRule ^/static/(.*)$ /conference/${lowercase:%{SERVER_NAME}}/$1 [L]
     RewriteCond %{REQUEST_URI} ^/global/
     RewriteRule ^/global/(.*)$ /conference/global/$1 [L]
</VirtualHost>
# Virtual Host 1
<VirtualHost xxx.xxx.xxx.xxx>
     ServerName conference-1.isp.com
     ServerAdmin contact1@isp.com
     DocumentRoot /usr/local/apache2/htdocs
     ErrorLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/conference-1.error.log"
     CustomLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/conference-1.access.log" combined
     RewriteEngine On
     RewriteMap lowercase int:tolower
     RewriteCond %{REQUEST_URI} ^/static/
     RewriteRule ^/static/(.*)$ /conference/${lowercase:%{SERVER_NAME}}/$1 [L]
     RewriteCond %{REQUEST_URI} ^/global/
     RewriteRule ^/global/(.*)$ /conference/global/$1 [L]
</VirtualHost>

#Second Conference (Same IP address as above)
<VirtualHost xxx.xxx.xxx.xxx>
     ServerName conference-2.isp.com
     ServerAdmin contact2@isp.com
     DocumentRoot /usr/local/apache2/htdocs
     ErrorLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/conference-2.error.log"
     CustomLog "|/usr/local/sbin/cronolog /usr/local/apache2/logs/%Y/%m/conference-2.access.log" combined
     RewriteEngine On
     RewriteMap lowercase int:tolower
     RewriteCond %{REQUEST_URI} ^/static/
     RewriteRule ^/static/(.*)$ /conference/${lowercase:%{SERVER_NAME}}/$1 [L]
     RewriteCond %{REQUEST_URI} ^/global/
     RewriteRule ^/global/(.*)$ /conference/global/$1 [L]
</VirtualHost>


We had a Conference Manager request us to be able to put up some additional documents that could be downloaded from the conference site. We also wanted it to be easy to post if needed a simple MOTD incase we had to take the server down for any length of time. I'm not sure if you have thought about it but a simple admin level interface could be setup to upload additional documents that could be linked to from various places since the admin forms allow html in them as well.

Since I like separate log files I also separated them out incase the conference managers wanted statistics later on.

I also added the following index.php at the root of our server to redirect based upon HTTP_HOST.

Code: Select all
<?php
switch ($HTTP_SERVER_VARS['HTTP_HOST']) {
case "conferences.isp.com":
  echo '<meta http-equiv="refresh" content="0; URL=http://conferences.isp.com/ocs/index.php">';
  break;
case "conference-1.isp.com":
  echo '<meta http-equiv="refresh" content="0; URL=http://conference-1.isp.com/ocs/index.php?cf=1">';
  break;
case "conference-2.isp.com":
  echo '<meta http-equiv="refresh" content="0;
URL=http://conference-2.isp.com/ocs/index.php?cf=2">';
  break;
}
?>


This allows each conference to be refered to directly by:
http://conference-1.isp.com
http://conference-2.isp.com

And it still maintains the central site at:
http://conferences.isp.com

It then allows each conference to have a separate "static" area refered to directly by say http://conference-1.isp.com/static/document.doc
and also a "global" area refered to directly by http://conference-1.isp.com/global/motd.html

etc.

At least it seems to work here for us we haven't run into any obvious problems yet, as always your millage may vary.

One thing I did notice is that the OAI part returns all records reguardless of conference, a good suggestion would be to treat each conference as a OAI "Set" so that a harvester could harvest a single conference only if they wanted to or if you adopt the above code changes the OAI script should only return records from the conference associated with ServerName it was called by.

Brian.
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh


Return to OCS Technical Support

Who is online

Users browsing this forum: Bing [Bot], jcurtis and 3 guests