Forum

webapp in URL path

Lars
18 October 2015, 16:47
Hello,

I've set up Hiawatha 9.15 to serve a simple web-site with some static content, located in /srv/www/main. It shall be accessible via simple http. Let's call the site http://www.site.net

Now, I'd like to put a web-app (ownCloud, root directory is /srv/www/cloud/owncloud) in the URL-path 'cloud', i.e. the ownCloud instance shall only be TSL-accessible via https://www.site.net/cloud (https://www.site.net/ shall return the main page).

My current configuration, which basically works:

UrlToolkit {
ToolkitID = ownCloud
Match ^/cloud/data DenyAccess
}
VirtualHost {
Hostname = www.site.net
WebsiteRoot = /srv/www/main
StartFile = index.html
AccessLogfile = /var/log/hiawatha/main.access.log
ErrorLogfile = /var/log/hiawatha/main.error.log
UseToolkit = ownCloud
Alias = /cloud:/srv/www/cloud/owncloud
WebDAVapp = yes
EnablePathInfo = yes
UseFastCGI = PHP5
RequireSSL = yes
}


This has some issues:
- The RequireSSL = yes entry enforces a http://www.site.net -> https://www.site.net redirect. As I'm using a self-signed certificate, this gives a certificate warning. However, I don't want to bother occasional visitors of the main page with this warning.
- CGI/PHP enabled/accessible on the main page

Basically, I'd like something like the following. Either an improved UrlToolkit:
UrlToolkit {
ToolkitID = ownCloud
Match ^/cloud/data DenyAccess

# NOTE: next lines are not valid in UrlToolkit!
Match ^/cloud/ WebsiteRoot = /srv/www/cloud/owncloud
Match ^/cloud/ AccessLogfile = /var/log/hiawatha/cloud.access.log
Match ^/cloud/ ErrorLogfile = /var/log/hiawatha/cloud.error.log
Match ^/cloud/ WebDAVapp = yes
Match ^/cloud/ EnablePathInfo = yes
Match ^/cloud/ UseFastCGI = PHP5
Match ^/cloud/ RequireSSL = yes
}

VirtualHost {
Hostname = www.site.net
WebsiteRoot = /srv/www/main
StartFile = index.html
AccessLogfile = /var/log/hiawatha/main.access.log
ErrorLogfile = /var/log/hiawatha/main.error.log
UseToolkit = ownCloud
}


...or maybe 2 virtual hosts:

# main
VirtualHost {
Hostname = www.site.net
WebsiteRoot = /srv/www/main
StartFile = index.html
AccessLogfile = /var/log/hiawatha/main.access.log
ErrorLogfile = /var/log/hiawatha/main.error.log
}

# ownCloud
UrlToolkit {
ToolkitID = ownCloud
Match ^/data DenyAccess
}
VirtualHost {
# NOTE: next line is not valid!
Hostname = www.site.net/cloud
WebsiteRoot = /srv/www/cloud/owncloud
StartFile = index.php
AccessLogfile = /var/log/hiawatha/cloud.access.log
ErrorLogfile = /var/log/hiawatha/cloud.error.log
UseToolkit = ownCloud
WebDAVapp = yes
EnablePathInfo = yes
UseFastCGI = PHP5
RequireSSL = yes
}


Any ideas how to handle this?

regards

Lars

BTW: The man-page talks about RequireTLS, however in the config file only RequireSSL works.
Hugo Leisink
18 October 2015, 19:58
Why going though all this trouble if you can simply use http://www.site.net/ for your static content and, for example, https://cloud.site.net/ for your ownCloud website?
Lars
19 October 2015, 08:59
Right, this would be the proper solution, but I've got a DynDNS site, so the host name is more like http://lars.site.net/. The cloud service would then be something like https://cloud.lars.site.net/ (vs. https://lars.site.net/cloud/).

I'm just migrating from lighttpd, where I've got this setup running.

Having two virtual hosts seems to be the cleaner solution. I'll try the setup with the different hostnames.
This topic has been closed.