Virtualhost, Rewrite, host and webdav

Author Message

Hugo Sandoval

Wednesday 07 April 2010 12:56:40 pm

Hello.

I am having troubles with my virtualhost configuration and rewrite, because the webdav isn't working.

The siteaccess is by host name.

This is my apache configuration:

<VirtualHost ip.ip.ip.ip:80>
SuexecUserGroup "#id" "#id"
ServerName domain.com
ServerAlias www.domain.com
ServerAlias administrador.domain.com

DocumentRoot /home/user/public_html
ErrorLog /var/log/virtualmin/domain.com_error_log
CustomLog /var/log/virtualmin/domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/user/cgi-bin/
ScriptAlias /awstats /home/user/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/user/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
</Directory>
<Directory /home/user/cgi-bin>
allow from all
</Directory>
RewriteEngine on
UseCanonicalName off
<IfModule mod_php5.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>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule content/treemenu/? /index_treemenu.php [L]
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 ^/extension/[^/]+/design/[^/]+/(flash|stylesheets|images|javascripts?)/.* - [L]
RewriteRule ^/extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon\.ico - [L]
RewriteRule ^/robots\.txt - [L]
RewriteRule ^/var/[^/]+/cache/public/.* - [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>

<Files awstats.pl>
AuthName "domain.com statistics"
AuthType Basic
AuthUserFile /home/user/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/user/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName domain.com
AuthUserFile /home/user/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RewriteEngine off
</Location>
</VirtualHost>

I configured webdav.ini.append.php in override with:

[GeneralSettings]
EnableWebDAV=true
Logging=enabled

When use konqueror to access webdav with another domain without ezpublish installed and no apache rewrite configured:

webdav://www.anotherdomain.com/dav/

It work very well.

But with ezpublish apache rewrite configuration:

Operation cannot be completed (sorry, translated from spanish)

The folder doesn't exists...

What else I need to config?

.·. .·. .·. .·. .·. .·. .·.
http://www.softwarelibre.com.ve/

Hugo Sandoval

Wednesday 07 April 2010 2:05:01 pm

New behaviour:

Modifiying dns and using konqueror:

webdav://dav.domain.com/dav/

Ask for user and password but show index.php file opened by kwrite (embedded in konqueror), even can edit it online!

.·. .·. .·. .·. .·. .·. .·.
http://www.softwarelibre.com.ve/

Hugo Sandoval

Friday 09 April 2010 9:24:18 am

[Solved]

Create another file in apache with name (optional):

webdav.domain.com.conf

(I repeat: that name is optional)

The content is something like:

************************ <cut here>

<VirtualHost xxx.xxx.xxx.xxx:80>
SuexecUserGroup "#id" "#id"
ServerName webdav.domain.com
DocumentRoot /home/user/public_html
ErrorLog /var/log/virtualmin/webdav.domain.com_error_log
CustomLog /var/log/virtualmin/webdav.domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/user/cgi-bin/
ScriptAlias /awstats /home/user/cgi-bin
DirectoryIndex webdav.php index.php
<Directory /home/user/public_html>
Options Indexes FollowSymLinks
allow from all
AllowOverride All
</Directory>
<Directory /home/user/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteRule . /webdav.php
<Files awstats.pl>
AuthName "domain.com statistics"
AuthType Basic
AuthUserFile /home/user/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/user/public_html
<Location /dav>
DAV On
AuthType Basic
AuthName domain.com
AuthUserFile /home/user/etc/dav.digest.passwd
Require valid-user
Satisfy All
RewriteEngine off
</Location>
</VirtualHost>

*********************<cut here>

The interesting part is:

RewriteRule . /webdav.php

webdav.domain.com must be reachable, so, must be defined in DNS.

Then, in konqueror:

webdav://webdav.domain.com ask for username and password and show the siteaccess folder of my ezpublish site.

.·. .·. .·. .·. .·. .·. .·.
http://www.softwarelibre.com.ve/

Nicolas Pastorino

Monday 12 April 2010 1:51:44 am

Thanks for sharing Hugo!

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.