Forums / Install & configuration / Apache config for eZ hostname access & other apps?

Apache config for eZ hostname access & other apps?

Author Message

Mike Machnik

Friday 02 February 2007 7:22:27 am

Has anyone had any success running eZ in hostname access mode alongside other applications, on the same domain?

For example: eZ and apache are configured for hostname access for www.domain.com. eZ exists in the directory "/home/user1/public_html/ez" which is what DocumentRoot is set to.

However, you have another application located in "/home/user1/public_html/app2" that you would like to be able to access, for example at the URL "http://www.domain.com/app2".

Normally what happens is that eZ looks for the module "app2" and does not find it, and gives you a kernel(20) error.

I have tried adding Aliases to the VirtualHost in httpd.conf i.e.

<VirtualHost w.x.y.z>
ServerAlias domain.com
Alias /app2 /home/user1/public_html/app2
DocumentRoot /home/user1/public_html/ez
ServerName www.domain.com
...

But still getting the kernel error.

I've also tried this in "/home/user1/public_html/.htaccess"

RewriteEngine On
RewriteRule /app2$ /app2$1 [L]

and this in "/home/user1/public_html/ez/.htaccess"

...
<FilesMatch "(^app2$)|(index\.php|\.(gif|jpe?g|png|css|js|html)|var(.+)storage.pdf(.+)\.pdf)$">
...

No difference there either.

Thanks in advance for any help...

Kim Johansen

Monday 05 February 2007 12:01:16 am

Check apache error-log and rewrite-log to see whats happening.

You can find more about the vhost-configuration here: http://ez.no/doc/ez_publish/technical_manual/3_8/installation/virtual_host_setup

Try out Free eZ Publish 4.0 Trial Hosting for 14 days:
http://webdealhosting.com/ez-publish-trial-hosting

High quality eZ Publish Hosting since 2001!

Mike Machnik

Wednesday 07 February 2007 9:09:38 am

Thank you...the rewrite log did help. Here is what works now: add these three lines to the VirtualHost:

Alias "/test" "/home/user1/public_html/test"

RewriteRule ^/test/(.*)$ /test/$1 [L,PT]
RewriteRule ^/test$ /test/ [R=301,L]

I took out my .htaccess changes, not needed. I only needed the above three lines in VirtualHost.

Hope this helps someone else too...

Timmothy Green

Wednesday 07 February 2007 12:37:27 pm

I have used the following method to accomplish this:

Alias "/test" "/home/user1/public_html/test"

RewriteEngine On
RewriteCond  %{REQUEST_URI}   !^/test/(.*)$
    RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|swf|wmv)$ /index.php

This instructs Apache to apply the RewriteRule to the requested URL as long as it does not contain "/test/". It essentially bypasses the RewriteRule based on whatever condition you choose.

End result is the same but I thought I would share another option.

Automation Technologies, Inc.
http://www.ati4it.com

Linh Vu

Wednesday 07 February 2007 5:39:40 pm

Just throwing in my 2c...

I use the same method as Tim's, although the (.*) is not necessary and using a catch-all wildcard in regex is generally not recommended unless you want a wholesale redirection.

Mike's method works but is not safe both because of Apache's internal order of processing rules (Redirect, Alias, Rewrite and ScriptAlias - note: not in this order, just a list). You can easily run into problems if you rely on this, so it's best to be specific and tell ezPublish, via a RewriteCond, not to process those folders.

Here's my general ezPublish Apache config:

    ServerName example.com
    ServerAlias www.example.com admin.example.com

    RewriteEngine On
    # no-www
    RewriteCond %{HTTP_HOST} ^www.example.com$
    RewriteRule ^/?(.*) http://example.com/$1 [R=301,L]

    # eZ publish
    # Excluding custom app folders
    RewriteCond %{REQUEST_URI} !(^/app1|^/app2|^/app3) [NC]
    RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons).*\.(gif|css|htc|jpg|png|jar|js|ico|pdf|swf)$ /index.php [L]

If I had more time, I would write less code.

eZ debug

Timing: Jan 18 2025 15:17:28
Script start
Timing: Jan 18 2025 15:17:28
Module start 'content'
Timing: Jan 18 2025 15:17:29
Module end 'content'
Timing: Jan 18 2025 15:17:29
Script end

Main resources:

Total runtime1.2761 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 589.3984180.8047
Module start 'content' 0.00761.1404 770.2031642.7578
Module end 'content' 1.14800.1280 1,412.9609337.0625
Script end 1.2760  1,750.0234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3280210.0002
Check MTime0.00170.1318210.0001
Mysql Total
Database connection0.00140.107210.0014
Mysqli_queries1.198593.92012040.0059
Looping result0.00200.16002020.0000
Template Total1.246897.720.6234
Template load0.00210.163220.0010
Template processing1.244797.542720.6224
Template load and register function0.00010.008810.0001
states
state_id_array0.00070.057710.0007
state_identifier_array0.00170.136320.0009
Override
Cache load0.00170.1323470.0000
Sytem overhead
Fetch class attribute can translate value0.00140.106250.0003
Fetch class attribute name0.00120.094070.0002
XML
Image XML parsing0.00320.253350.0006
class_abstraction
Instantiating content class attribute0.00000.001170.0000
General
dbfile0.00360.2820330.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs