Forums / Setup & design / Help needed - Setup multiple websites

Help needed - Setup multiple websites

Author Message

Johannes Lachman

Friday 02 November 2007 6:12:14 am

Hi everyone,

I need some help with the configuration of my webserver. I'm new with EZ and CMS systems and i'm trying to host 2 (later on more...) websites with 1 EZ installation. I've read a lot of forumposts and documentation, but i still aint getting it right.

So far the result is (as i can see it)
When i go to site1, all goes well... i see the startpage and everything.
When i go to site2, i can see that it read the SiteName attribute from the SiteAccess of the other website. So i guess that went ok.

I divided the Var DIR and DB (copies of the original stuff) and linked Site2 to the new Var dir and DB.

But as result for Site2 i see:

<b>Error / kernel (1) </b>
Access denied
You do not have permission to access this area.

<b>Does anyone know if i really divided the two sites apart now and if so, why i can't acces Site2?</b>

I'll give more info about my config down below. I hope someone can help me out... I would really appreciate it!

<b>Info:</b>

<i>Var Dirs</i>: Just a copy of the original Var dir
<i>Database</i>: Just a copy of the original DB

<b><i>Settings/Override/site.ini.append.php:</i></b>
[SiteSettings]
DefaultAccess=eyc
SiteList[]
SiteList[]=dut
SiteList[]=eyc
SiteList[]=eycadmin
SiteList[]=ezechiel
SiteList[]=ezladmin
RootNodeDepth=1

[SiteAccessSettings]
CheckValidity=false
AvailableSiteAccessList[]
AvailableSiteAccessList[]=dut
AvailableSiteAccessList[]=eyc
AvailableSiteAccessList[]=eycadmin
AvailableSiteAccessList[]=ezechiel
AvailableSiteAccessList[]=ezladmin
MatchOrder=host
HostMatchMapItems[]=eyc.getmyip.com;eyc
HostMatchMapItems[]=eyc.getmyip.com/eycadmin;eycadmin
HostMatchMapItems[]=ezlwebserver.homeip.net;ezechiel
HostMatchMapItems[]=ezlwebserver.homeip.net/ezladmin;ezladmin

[FileSettings]
VarDir=var/ezwebin_site

<b>Different SiteAccesses</b>
- admin
- dut
- eyc (original)
- eycadmin (original)
- ezechiel (new)
- ezladmin (new)
- setup

<b><i>Settings/siteaccess/eyc/site.ini.append.php:</i></b>

[DatabaseSettings]
DatabaseImplementation=ezmysql
Server=localhost
User=root
Password=
Database=<b>eyc</b>
Charset=
Socket=disabled

[SiteSettings]
SiteName=<b>www.eyc.cc</b>
SiteURL=localhost
LoginPage=embedded
AdditionalLoginFormActionURL=http://localhost/eycadmin/user/login

[SiteAccessSettings]
RequireUserLogin=false
RelatedSiteAccessList[]
RelatedSiteAccessList[]=dut
RelatedSiteAccessList[]=eyc
RelatedSiteAccessList[]=eycadmin
ShowHiddenNodes=false

[FileSettings]
VarDir=<b>var/ezwebin_site</b>

<b><i>Settings/siteaccess/eycadmin/site.ini.append.php:</i></b>

[DatabaseSettings]
DatabaseImplementation=ezmysql
Server=localhost
User=root
Password=
Database=<b>eyc</b>
Charset=
Socket=disabled

[SiteSettings]
SiteName=<b>www.eyc.cc</b>
SiteURL=localhost
LoginPage=custom

[SiteAccessSettings]
RequireUserLogin=true
RelatedSiteAccessList[]=dut
RelatedSiteAccessList[]=eyc
RelatedSiteAccessList[]=eycadmin
ShowHiddenNodes=true

[FileSettings]
VarDir=<b>var/ezwebin_site</b>

<b><i>Settings/siteaccess/ezechiel/site.ini.append.php:</i></b>

[DatabaseSettings]
DatabaseImplementation=ezmysql
Server=localhost
User=root
Password=
Database=<b>ezechiel</b>
Charset=
Socket=disabled

[SiteSettings]
SiteName=<b>www.ezechiel.org</b>
SiteURL=ezlwebserver.homeip.net
LoginPage=embedded
AdditionalLoginFormActionURL=http://ezlwebserver.homeip.net/ezladmin/user/login

[SiteAccessSettings]
RequireUserLogin=false
RelatedSiteAccessList[]
RelatedSiteAccessList[]=ezechiel
RelatedSiteAccessList[]=ezladmin
ShowHiddenNodes=false

[FileSettings]
VarDir=<b>var/ezechiel</b>

<b><i>Settings/siteaccess/ezladmin/site.ini.append.php:</i></b>

[DatabaseSettings]
DatabaseImplementation=ezmysql
Server=localhost
User=root
Password=
Database=<b>ezechiel</b>
Charset=
Socket=disabled

[SiteSettings]
SiteName=<b>www.ezechiel.org</b>
SiteURL=ezlwebserver.homeip.net
LoginPage=custom

[SiteAccessSettings]
RequireUserLogin=true
RelatedSiteAccessList[]=ezechiel
RelatedSiteAccessList[]=ezladmin
ShowHiddenNodes=true

[DesignSettings]
SiteDesign=<b>eycadmin</b>
AdditionalSiteDesignList[]=admin

[FileSettings]
VarDir=<b>var/ezechiel</b>

<b><i>httpd.conf:</i></b>
NameVirtualHost 83.86.36.177

<VirtualHost 83.86.36.177>
<Directory var/ezwebin_site>
Options FollowSymLinks
AllowOverride None
</Directory>

<IfModule mod_php4.c>
php_admin_flag safe_mode Off
php_admin_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value allow_call_time_pass_reference 0
</IfModule>

DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On
Rewriterule ^/var/storage/.* - [L]
Rewriterule ^/var/[^/]+/storage/.* - [L]
RewriteRule ^/var/cache/texttoimage/.* - [L]
RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^/share/icons/.* - [L]
Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon.ico - [L]
RewriteRule ^/robots.txt - [L]
# Uncomment the following lines when using popup style debug.
# RewriteRule ^/var/cache/debug.html.* - [L]
# RewriteRule ^/var/[^/]+/cache/debug.html.* - [L]
RewriteRule .* /index.php
</IfModule>

DocumentRoot var/ezwebin_site
ServerName eyc.getmyip.com
ServerAlias eyc.getmyip.com/eycadmin
</VirtualHost>
<VirtualHost 83.86.36.177>
<Directory var/ezechiel>
Options FollowSymLinks
AllowOverride None
</Directory>

<IfModule mod_php4.c>
php_admin_flag safe_mode Off
php_admin_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value allow_call_time_pass_reference 0
</IfModule>

DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On
Rewriterule ^/var/storage/.* - [L]
Rewriterule ^/var/[^/]+/storage/.* - [L]
RewriteRule ^/var/cache/texttoimage/.* - [L]
RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^/share/icons/.* - [L]
Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon.ico - [L]
RewriteRule ^/robots.txt - [L]
# Uncomment the following lines when using popup style debug.
# RewriteRule ^/var/cache/debug.html.* - [L]
# RewriteRule ^/var/[^/]+/cache/debug.html.* - [L]
RewriteRule .* /index.php
</IfModule>

DocumentRoot var/ezechiel
ServerName ezlwebserver.homeip.net
ServerAlias ezlwebserver.homeip.net/ezladmin
</VirtualHost>

Kind regards,
JL

Sebastiaan van der Vliet

Friday 02 November 2007 8:54:45 am

Hello Johannes,

Is it possible to log in onto the administrative backend of site 2? If you can login there, go the the "Users accounts" section. Click on "roles and policies", and then on the link "Anonymous ". Check if the user login siteaccess rule includes the siteaccess for site 2.

Kind regards,
Sebastiaan

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

Johannes Lachman

Saturday 03 November 2007 1:17:33 am

Hi Sebastiaan,

Thanks for the reply. I never actually tried that :S
I notice that i can't even connect to the admin section of Site1.
I can login as admin, but only on the website itself, not the adminpanel.
It says "Module cannot be found".

Did i link my adminsection in a wrong way?

Stefan de Bruijn

Saturday 03 November 2007 10:29:36 am

Hi Johannes,

You have set the matchorder to 'host', but are using an uri for the admin access:
HostMatchMapItems[]=eyc.getmyip.com;eyc
HostMatchMapItems[]=eyc.getmyip.com/eycadmin;eycadmin

When MatchOrder is set to host, you must use virtual hosts, for instance:
HostMatchMapItems[]=eyc.getmyip.com;eyc
HostMatchMapItems[]=eycadmin.getmyip.com;eycadmin

The first line is a correct host, so that will work.
If you want 'HostMatchMapItems[]=eyc.getmyip.com/eycadmin;eycadmin ' to work, set MatchOrder to 'uri'.
See
http://ez.no/doc/ez_publish/technical_manual/3_9/reference/configuration_files/site_ini/siteaccesssettings/matchorder

The same applies for your apache settings.You can only use hostnames as a serveralias (http://httpd.apache.org/docs/2.2/mod/core.html#serveralias). You also have 2 virtualhosts with the same name (i suppose apache will use the first one).

You say you want to have multiple sites in 1 Ez Publish installation. 1 apache vhost will then be sufficient (if its the only, or first vhost, you don't have to set serveraliasses as it will be the default host).

The <Directory var/ezwebin_site> should then point to the root of the ez-publish install, which it probably does, but <Directory var/ezechiel> points to another directory. Do you have another ez installed in this directory?

regards,
Stefan de Bruijn

Johannes Lachman

Sunday 04 November 2007 11:58:00 pm

Hi Stefan,

Thanks for the reply.
I changed the MatchOrder to <b>"host;uri"</b>

I've deleted the serveraliases. If apache will only look at the first vhost, what about the the following code in the vhost?
<b>
<Directory var/ezwebin_site>
Options FollowSymLinks
AllowOverride None
</Directory>
</b>

The directory is not the same for Site2... (var/ezechiel)

When i login on admin of eyc (eycadmin) i get "Page not Found" error. In the site.ini settings i changed localhost to the real URI. See down below. But i still get the error. Do i have to restart some services when i change the settings?

<b>siteaccess\eyc:</b>
[SiteSettings]
SiteName=www.eyc.cc
SiteURL=<b>eyc.getmyip.com</b> <-- it was localhost
LoginPage=embedded
AdditionalLoginFormActionURL=<b>http://eyc.getmyip.com/eycadmin/user/login</b>
<-- it was localhost/eycadmin.....

When i log in Site2 i still get the error "Module not Found". There i get the following url: http://ezlwebserver.homeip.net/ezladmin/user/login

Any ideas?

<b>The <Directory var/ezwebin_site> should then point to the root of the ez-publish install, which it probably does, but <Directory var/ezechiel> points to another directory. Do you have another ez installed in this directory?</b>
No, i did not install a second EZ. I thought that if i wanted to change Site2 in an other way than Site1, they had to have different Var Directories. var/ezechiel is just a copy of var/ezwebin_site, which was the original var of the installation.

I hope you or someone else has more advise for me... :)

Regards,
Johannes

Stefan de Bruijn

Tuesday 06 November 2007 7:47:08 am

<i>II've deleted the serveraliases. If apache will only look at the first vhost, what about the the following code in the vhost?</i>I
Apache will of course look at all vhosts, but you named them the same.

<Directory var/ezwebin_site>
Options FollowSymLinks
AllowOverride None
</Directory>

You can have multiple directory directives in apache for different directory settings. Not necessary though for a standard installation. What's more puzzling: you have set: "DocumentRoot var/ezwebin_site"
I supposed you had installed ez in the linux /var directory.
Documentroot should point to the root of your ez publish installation.
Look at: http://ez.no/doc/ez_publish/technical_manual/3_10/installation/virtual_host_setup for instructions on virtual host.

<i>When i log in Site2 i still get the error "Module not Found". There i get the following url: http://ezlwebserver.homeip.net/ezladmin/user/login</i>
It should also be a 404 based on your apache setting. Please first set these correct.
I principle:
404 error: apache settings are wrong
Oject not found: that's a response from ez publish. can be apache setting (for instance rewrite rules) or ez publish settings (or simply asking a non existing object).

<i>No, i did not install a second EZ. I thought that if i wanted to change Site2 in an other way than Site1, they had to have different Var Directories. var/ezechiel is just a copy of var/ezwebin_site, which was the original var of the installation.</i>
They do, but you don't set these in apache but in your siteaccess settings you specify wich var directory ez publish uses (as you already did).

Johannes Lachman

Thursday 08 November 2007 5:51:23 am

Hmm... ok i started again with a clean install, since i have been experimenting a lot with the configs. :-)

The 2 sites work now with localhost on the server itself.
(localhost/siteA, localhost/siteadminA, localhost/siteB and localhost/siteadminB)

So now i want to reach the sites with my two domainnames.
But both domainnames point to my default siteaccess. So did i miss something in my vhosts?
Please check my new vhosts down below.

I've put this code in de Override/site.ini

[SiteSettings]
DefaultAccess=ezechiel
SiteList[]
SiteList[]=dut
SiteList[]=ezechiel
SiteList[]=ezladmin
SiteList[]=eyc
SiteList[]=eycadmin
RootNodeDepth=1

[SiteAccessSettings]
CheckValidity=false
AvailableSiteAccessList[]
AvailableSiteAccessList[]=dut
AvailableSiteAccessList[]=ezechiel
AvailableSiteAccessList[]=ezladmin
AvailableSiteAccessList[]=eyc
AvailableSiteAccessList[]=eycadmin
MatchOrder=uri
HostMatchMapItems[]
HostMatchMapItems[]=eyc.getmyip.com;eyc
HostMatchMapItems[]=eyc.getmyip.com/eycadmin;eycadmin
HostMatchMapItems[]=ezlwebserver.homeip.net;ezechiel
HostMatchMapItems[]=ezlwebserver.homeip.net/ezladmin;ezladmin

And these 2 virtual hosts in the httpd.config

<VirtualHost eyc.getmyip.com>
<Directory C:/eZpublish/ezpublish>
Options FollowSymLinks
AllowOverride None
</Directory>

ServerName eyc.getmyip.com
ServerAdmin [email protected]
DocumentRoot "c:\eZpublish\eZpublish"

RewriteEngine On
RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons|^/share/pic).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

</VirtualHost>

<VirtualHost ezlwebserver.homeip.net>
<Directory C:/eZpublish/ezpublish>
Options FollowSymLinks
AllowOverride None
</Directory>

ServerName ezlwebserver.homeip.net
ServerAdmin [email protected]
DocumentRoot "c:\eZpublish\eZpublish"

RewriteEngine On
RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons|^/share/pic).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

</VirtualHost>

Greg McAvoy-Jensen

Thursday 08 November 2007 6:22:19 am

Johannas,

You'll need to set MatchOrder to host, not uri.

Tot ziens.

Greg McAvoy-Jensen

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Johannes Lachman

Friday 09 November 2007 1:53:32 am

Ahh yes than it works except my /admin panels dont work anymore. (page cannot be found)
Is it only one or the other? Host or Uri? and not both?

Heath

Friday 09 November 2007 2:11:54 am

I think that fallbacks are still supported ... try using both. Here is an untested settings example of what I suggest. See MatchOrder ...

This is a pattern / feature found in the default settings. <i>http://pubsvn.ez.no/nextgen/trunk/settings/site.ini</i>

[SiteAccessSettings]
# <snip />
# MatchOrder=host;uri
# or ...
# MatchOrder=uri;host
MatchOrder=host;uri
HostMatchMapItems[]=eyc.getmyip.com;eyc
HostMatchMapItems[]=eyc.getmyip.com/eycadmin;eycadmin
HostMatchMapItems[]=ezlwebserver.homeip.net;ezechiel
HostMatchMapItems[]=ezlwebserver.homeip.net/ezladmin;ezladmin

Another (possibly <i>better</i>) suggestion is for you to stop using uri method to access the admin. You would be better of using a dns host alias in your local hosts file or dns for admin.yourdomain.com

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Johannes Lachman

Thursday 29 November 2007 2:29:42 am

Hi again,

I tried the following down below...
"Is it possible to log in onto the administrative backend of site 2? If you can login there, go the the "Users accounts" section. Click on "roles and policies", and then on the link "Anonymous ". Check if the user login siteaccess rule includes the siteaccess for site 2."

But i still get the access denied for my second site. Only when i log in and log out again. The content is visible for the time that i am active on the site.

Are there some other policies that i have to include?

Further more i notice that the sitename of settings\override\site.ini.append.php is used and not the sitename of settings\siteaccess\eyc (second site). What must i do to let him use the params of my siteaccess specific file? i see that the sites show different content, but i guess i missed a step somewhere. Some advise please... :-)

Kind regards,
Johannes

Greg McAvoy-Jensen

Tuesday 08 July 2008 3:28:33 pm

For the record--clearing the cache may have been the other step he needed. It just worked for me.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Jameel Rahmaan

Friday 01 August 2008 6:11:57 am

I have a very similar problem with my multi site install using virtual hosts and a single database with the site access files limiting the viewable content and start nodes accordingly.

In my case all the admin sites work with the right content restrictions but all the user sites have the same issue where access is denied to the anonymous user. As soon as I log in, I get the right content displayed according to the section limits I have set up.

All of my user site access and my overrride site.ini files have

[SiteAccessSettings]
DefaultAccess=tdi_user (or other user site access)
RequireUserLogin=false

Apache is also set up to allow anonymous access and I have changed the anonymous role to have viewing rights on my new sections.

I also have a different cache directory set for each siteaccess.

I have also played around with the settings in the override/site.ini.append.php and siteaccess/site.ini.append.php files to see if other combinations would help but nothing works. And yes, I do clear the cache after every ini file change.

What I don't understand is why my settings are being ignored and the anonymous user cannot see content. The error log is not much help:
[ Aug 01 2008 13:00:02 ] [5.0.4.102] Timing Point: Module start 'content'
[ Aug 01 2008 13:00:02 ] [5.0.4.102] error/view.php:
Error ocurred using URI: /index.php

Do I absolutely need to use a different database for each site or is there some other config setting I am overlooking? Any help would be appreciated.

Greg McAvoy-Jensen

Friday 01 August 2008 8:26:21 am

You can use the same database. However, as I understand it, the number of databases dictates the number of var directories. Each database should have exactly one var directory.

Have you given the anonymous user login privileges on the new siteaccess?

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Jameel Rahmaan

Friday 01 August 2008 8:38:39 am

The anonymous user has the following role:

content read Section( Standard , Bigbuoy )
content pdf Section( Standard , Bigbuoy )
user login No limitations

I'll update the var settings and clear the cache now.

Jameel Rahmaan

Friday 01 August 2008 9:00:59 am

Okay, that's better but still not all the way there.

The main site is now allowing anonymous users but the site that is limited to a particular section is still giving me an access denied error for the anonymous user. However the admin section is still coming up so I'm going through the site ini files to see if I've made a mistake somewhere.

Thanks for the help so far.

All sorted - browser cache issue on the site limited to one section