Mapping ownCloud-Subdirectory to Subdomain

Alles, was den Apache betrifft, kann hier besprochen werden.

Mapping ownCloud-Subdirectory to Subdomain

Postby kalabalik » 11. January 2016 22:49

I am trying to configure Apache 2.4 on an Ubuntu 14.04 server in order to map a ownCloud instance to my subdomain.domain.tld. I want to access ownCloud via the url owncloud.domain.tld, but currently I can only reach ownCloud with owncloud.domain.tld/owncloud or owncloud.domain.tld/index.html (or .php). I already have a wordpress, a moodle and a mailman instance installed. If I type (www.)domain.tld I get to my wordpress instance, if I type (www.)moodlesubdomain.domain.tld I get to my moodle instance, and if I type (www.)mailmansubdomain.domain.tld I get to my mailman instance. However, if I type in owncloud.domain.tld I end up at my wordpress instance at domain.tld. Please advise me how to reach my owncloud instance via owncloud.domain.tld.

Here is my /etc/apache2/apache2.conf:
Code: Select all
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
   Options FollowSymLinks
   AllowOverride None
   Require all denied
</Directory>
<Directory /usr/share>
   AllowOverride None
   Require all granted
</Directory>
<Directory /var/www/html>
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>
<FilesMatch "^\.ht">
   Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf


Here is my /etc/apache2/sites-enabled/owncloud.conf contains:
Code: Select all
<VirtualHost owncloud.domain.tld:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/html/owncloud
   ServerName owncloud.domain.tld
   ServerAlias www.owncloud.domain.tld
   <Directory /var/www/html/owncloud>
      Options +FollowSymLinks
      AllowOverride All

      <IfModule mod_dav.c>
         Dav off
      </IfModule>
      SetEnv HOME /var/www/html/owncloud
      SetEnv HTTP_HOME /var/www/html/owncloud
   </Directory>
   <Directory "/var/ocdata/">
      # just in case .htaccess gets disabled
      Require all denied
   </Directory>
   ErrorLog /var/log/apache2/owncloud-error.log
   CustomLog /var/log/apache2/owncloud-access.log combined   
</VirtualHost>


apache2ctl -S returns:
Code: Select all
VirtualHost configuration:
MY.IP.MY.IP:80      is a NameVirtualHost
         default server domain.tld (/etc/apache2/sites-enabled/default-wordpress.conf:1)
         port 80 namevhost domain.tld (/etc/apache2/sites-enabled/default-wordpress.conf:1)
                 alias www.domain.tld
         port 80 namevhost mailman.domain.tld (/etc/apache2/sites-enabled/mailman.conf:1)
                 alias www.mailman.domain.tld
         port 80 namevhost moodle.domain.tld (/etc/apache2/sites-enabled/moodle.conf:1)
                 alias www.moodle.domain.tld
         port 80 namevhost owncloud.domain.tld (/etc/apache2/sites-enabled/owncloud.conf:1)
                 alias www.owncloud.domain.tld
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: MODSEC_2.5
Define: MODSEC_2.7
Define: ENABLE_USR_LIB_CGI_BIN
User: name="www-data" id=33
Group: name="www-data" id=33


/var/www/html/owncloud/.htaccess contains:
Code: Select all
# Version: 8.1.5
<IfModule mod_headers.c>
  <IfModule mod_fcgid.c>
    <IfModule mod_setenvif.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Robots-Tag "none"
    Header set X-Frame-Options "SAMEORIGIN"
    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for CSS and JS files
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=7200, public"
  </FilesMatch>
</IfModule>
<IfModule mod_php5.c>
php_value upload_max_filesize 513M
php_value post_max_size 513M
php_value memory_limit 512M
php_value mbstring.func_overload 0
php_value always_populate_raw_post_data -1
php_value default_charset 'UTF-8'
php_value output_buffering off
<IfModule mod_env.c>
  SetEnv htaccessWorking true
</IfModule>
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
RewriteRule ^\.well-known/carddav /remote.php/carddav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/caldav/ [R=301,L]
RewriteRule ^apps/calendar/caldav\.php remote.php/caldav/ [QSA,L]
RewriteRule ^apps/contacts/carddav\.php remote.php/carddav/ [QSA,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteRule ^(\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>


Any ideas what I did wrong? Or any suggestions for debugging strategies? Many thanx!
Last edited by kalabalik on 13. January 2016 08:24, edited 1 time in total.
kalabalik
 
Posts: 3
Joined: 11. January 2016 22:17
Operating System: Ubuntu 14.04

Re: Mapping ownCloud-Subdirectory to Subdomain

Postby Nobbie » 12. January 2016 13:34

The Apache output does not match your configuration.

In your configuration and in your posting you called the VirtualHost "owncloud.domain.tld", but the output of Apache tells us "ownlcoudinstance.domain.tld"

If you dont show us real data (only copy&paste, nothing else), we cannot help you.
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04

Re: Mapping ownCloud-Subdirectory to Subdomain

Postby kalabalik » 13. January 2016 08:26

Alright, I edited the somewhat inconsistent anonymization. Except from being anonymized the data is as "real" as it gets. You are not asking me to de-anonymize, are you?
kalabalik
 
Posts: 3
Joined: 11. January 2016 22:17
Operating System: Ubuntu 14.04

Re: Mapping ownCloud-Subdirectory to Subdomain

Postby Nobbie » 13. January 2016 13:39

kalabalik wrote:You are not asking me to de-anonymize, are you?


Whatelse? Real data is real data. It is of course your decision, you may hide your data, but i do not help on anonymized data (due to the problem, that in many many many cases the cause of the problem is hidden as well).
Nobbie
 
Posts: 8779
Joined: 09. March 2008 13:04

Re: Mapping ownCloud-Subdirectory to Subdomain

Postby kalabalik » 13. January 2016 13:55

I suppose, by "hidden" you mean "written over" (and not "not yet provided"). It is your choice, of course, whether you want to help or not. Disposing simultaneously a possibly vulnerable configuration and my urls, however, seems to me like calling for more trouble. I believe a public forum should not (force to) increase hazards.
kalabalik
 
Posts: 3
Joined: 11. January 2016 22:17
Operating System: Ubuntu 14.04


Return to Apache

Who is online

Users browsing this forum: No registered users and 2 guests