1

I am working on moving current setup of owncloud from sub-domain https://cloud.example.com to sub-directory https://example.com/cloud to make all my apps covered by one SSL certificate. The problem is that owncloud makes redirect to login page, but Apache makes it within virtual host's DocumentRoot. Alias /cloud doesn't work - every request from /cloud fall to the main site. And PHP-FPM 7.3.33 throws error "Got error 'Primary script unknown'".

So, my httpd.conf:

<VirtualHost *:443>
    ServerName example.com
    DocumentRoot /var/www/html

    Alias /cloud /var/www/owncloud
    <Directory /var/www/owncloud>
        SSLRequireSSL
        Options +FollowSymLinks
        AllowOverride All
        Require all granted

        <IfModule mod_dav.c>
            Dav off
        </IfModule>

        SetEnv HOME /var/www/owncloud
        SetEnv HTTP_HOME /var/www/owncloud
        SetEnv MOD_X_SENDFILE_ENABLED 1

        XSendFile On
        XSendFilePath /var/tmp
    </Directory>
</VirtualHost>

/var/www/owncloud/config/config.php:

  'trusted_domains' => 
      array (
        0 => 'locahost',
        1 => 'example.com',
      ),
  'datadirectory' => '/var/lib/owncloud',
  'overwrite.cli.url' => 'https://example.com/cloud',
  'overwritewebroot' => '/cloud',

How can I achieve that?

Thank you.

1
  • 1
    Since you have a AllowOverride All check if there are .htaccess files that do unexpected rewrites.
    – HBruijn
    Aug 30, 2022 at 9:20

1 Answer 1

0

Solution is to set RewriteBase in OWNCLOUD_HOME/.htaccess:

RewriteBase /cloud

Everything works as expected now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .