Welcome to Geeklog, Anonymous Sunday, December 01 2024 @ 05:44 am EST

Geeklog Forums

Multi-site virtual hosts issue


Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
hopeful
I was trying to run two sites off the same core geeklog code using gHack's FAQ,

How can I run multiple sites using one code base?

I just have a problem with the following lines from his instructions,

"Finally, you'll want to direct each of your virtual hosts in your apache configuration to your geeklog installation, by setting DocumentRoot to /path/to/geeklog-1.3/public_html and restart Apache."


When I asked my hosting company they said,

"There is no way we can change the DocumentRoot like the way that article suggests. There are a few possible workarounds, but they would depend on the way geeklog was coded which we cannot tell as this is a third party application."


Does anyone think it is possible to get around this and if so how?

Regards,

Shane
Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
Hi Shane, this description is rather for people who have an own server. Aaccidentally I discussed this with Dirk the other day and he told me a trick:

You replace the require_once line in lib-common.php with:

Text Formatted Code
if ($_SERVER['HTTP_HOST'] == 'www.domain1.de') {
    require_once ('/path/to/geeklog/config1.php');
} else if ($_SERVER['HTTP_HOST'] == 'www.domain2.de') {
    require_once ('/path/to/geeklog/config2.php');
} (and so on)


 


So instead of just one config.php you end up with quite a few but non of them is called just config.php!

So, run one normal installation with config.php completely then alter lib-common as bove then alter config.php into config1.php.

Run a second installation with a new config.php (not config2.php) then at the end of the installation process you will get stuck because lib-common.php is looking for config2.php. NOW alter config.php into config2.php

You can go on like this, you`d now change lib-common.php to call config3.php and proceede a third installation with a fresh config.php


It is an extremely interesting way to get people onboard. You may change the config1.php in a way that the default theme is professional1 etc. So all of the users get their own themes and you may grant FTP access to them only to their theme (if that is possible with your account).

And there is even a trick to let them have access to their config1.php. You place it in a subdir e.g. /professional1/config/ and secure it with a .htaccess.

Now you got one problem if all of your MySQLs have one user and one password as it is the case when using Confix.

The trick is another require_once( '/path/to/geeklog/pwd.php' ); this time in your config1.php (also in the other configs) It replaces the whole block one! Thus the friends can even edit their config but not see the MySQL details.


Text Formatted Code
// +---------------------------------------------------------------------------+
// | (1) Database Settings                                                     |
// +---------------------------------------------------------------------------+

$_DB_host         = 'localhost';   // host name or IP address of your DB server
$_DB_name         = '##';     // name of your database,
                                   // must exist before running the installer!
$_DB_user         = '##';    // MySQL user name
$_DB_pass         = '##';    // MySQL password

// The table prefix is prepended to each table used by Geeklog to avoid name
// collisions with other tables that may already exist in your database.
$_DB_table_prefix = 'gl_';         // e.g. 'gl_'


 


Put the whole block one as above into a new file called pwd.php


Text Formatted Code

<?php

// +---------------------------------------------------------------------------+
// | (1) Database Settings                                                     |
// +---------------------------------------------------------------------------+

$_DB_host         = 'localhost';   // host name or IP address of your DB server
$_DB_name         = '##';     // name of your database,
                                   // must exist before running the installer!
$_DB_user         = '##';    // MySQL user name
$_DB_pass         = '##';    // MySQL password

// The table prefix is prepended to each table used by Geeklog to avoid name
// collisions with other tables that may already exist in your database.
$_DB_table_prefix = 'gl_';         // e.g. 'gl_'
?>



 


Now what about the pics of the user and articles? No problem:

Text Formatted Code
$_CONF['path_images']   = $_CONF['path_html'] . 'layout/professional1/images/';


 


Just make sure you make 2 subdirs under /images/ for articles and userpics and they must be 775 or 777 as usual.

Of course you can also change the other paths:

Text Formatted Code
$_CONF['path_system']   = $_CONF['path'] . 'system/';
$_CONF['path_log']      = $_CONF['path'] . 'logs_1/';
$_CONF['path_language'] = $_CONF['path'] . 'language/';
$_CONF['backup_path']   = $_CONF['path'] . 'backups_1/';
$_CONF['path_data']     = $_CONF['path'] . 'data_1/';


 
 Quote

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
1000ideen,

Wow, thanks for the detailed answer and clear explanation. So it is possible then. That's great news. Regretfully I am unable to try this now. I'm going to get stuck into it on saturday and I can't wait. I'm sure I'll be back to you.

Thanks very much for your help.

Shane
Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
Fantastic post what a concept.

This should be a sticky topic or turned into a hack/plugin.

Great stuff

Just my two cents
 Quote

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
curious
Hi,

I've got the first installation done and all is working ok.

I'm waiting for my hosting company to turn on globals for the second site. Meanwhile I think everything's ready.

I'm set up so I have two public_html directories called shanegibney.com and tenpennybags.com Both are in the same directory and beside /geeklog

So each of those has in lib_common.php

Text Formatted Code
if ($_SERVER['HTTP_HOST'] == 'www.domain1.de') {
    require_once ('/path/to/geeklog/config1.php');
} else if ($_SERVER['HTTP_HOST'] == 'www.domain2.de') {
    require_once ('/path/to/geeklog/config2.php');
}
 

(not the actual paths of course)

But really the lib_common.php in the first pubic directory shanegibney.com need only say
Text Formatted Code
if ($_SERVER['HTTP_HOST'] == 'www.domain1.de') {
    require_once ('/path/to/geeklog/config1.php');
}
 

and equivaltently for the lib_common in the second public directory tenpennybags.com Would that be correct?

Couldn't the issue of getting stuck at the end of the second site install be overcome by having config2.php already in place. So there'd actually be three config files, they being

config.php
config1.php
config2.php

And config.php and config1.php would actually be exactly the same.

Shane

Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
Absolutely fantastic. Both sites are working perfectly.

Using the three config files when setting up the second site works too and avoids error messages. There should definitely be an FAQ for this. I think 1000ideen/Dirk's method for multi sites is easier than gHacks, which is probably quite old now.

This is the most sophisticated think I've ever tried with Geeklog and I wasn't expecting it to work. But it does.

Big Celebration Brilliant thanks for your help.

Regards,

Shane
Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
Hi Shane, I don`t think it works with two public_html directories unless your domains are directed to the 2 different paths too, what seem sto be so in your case if it does work.

You only need to double the config and the layout. It was a bit difficult to read in courier: /layout/professional1/ and /layout/professional2/

True, you don`t get stuck if you still have one file named config.php.
 Quote

ironmax

Anonymous
The idea of having a multi-user CMS for Geeklog needs to be done for the 2.x version. So this means if the site owner wants to host multiple sub-domains for new users, they can. Instead of just http://www.example.com, they can allow new users to create their very own sub-site like http://site1.example.com, http://site2.example.com etc etc. Or they could allow the sub sites to be created after the root site like http://www.example.com/site1/, http://www.example.com/site2 and so on. As for DNSing, a script could be developed to make the additions of the new zone to be included. one style for Bind and another one for Microsoft. As for security, Geeklog has one if not the best security out on the market now.

I think something like this could go a long way to getting more users involved and market shares.

Any thoughts? Anyone?

Michael
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
I think this could be a very long discussion, would you mind opening a separate thread for this? There would be a lot to consider especially if you need root or server /DNS access etc. As for me I`d stay with a GL that can be managed on normal webspace.
 Quote

All times are EST. The time is now 05:44 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content