Koozali.org: home of the SME Server
Contribs.org Forums => Koozali SME Server 10.x Contribs => Topic started by: Mace on June 17, 2021, 05:42:55 AM
-
I'm almost there :-)
I have Nextcloud running well. I followed the steps at https://wiki.koozali.org/Nextcloud#Use_a_dedicated_domain_to_connect_to_Nextcloud (https://wiki.koozali.org/Nextcloud#Use_a_dedicated_domain_to_connect_to_Nextcloud) and finally got LetsEncrypt to successfully gave me certs for my main domain, which I'll call mydomain.com, and one for nextcloud.mydomain.com after the domain property letsencryptSSLcert was set on both mydomain.com and nextcloud.mydomain.com
When I go to any of the following addresses (all https://) it shows the content of the Primary I-bay instead of /usr/share/nextcloud:
nextcloud.mydomain.com
nextcloud.mydomain.com/nextcloud
mydomain.com/nextcloud
my-external-ip/nextcloud
When I go to my-internal-ip/nextcloud it comes up correctly.
I verified all the db config options are correct according to the Nextcloud contrib wiki. Could it be that SME thinks that nextcloud.mydomain.com and mydomain.com are two separate domains instead of nextcloud.mydomain.com being a host belonging to mydomain.com? That's all I can think of at the moment.
Sorry if it's something obvious. I think I'm very close to it working though.
-
I missed an important parameter. I set it to public with
config setprop nextcloud access public
and now have it working on
nextcloud.mydomain.com/nextcloud
mydomain.com/nextcloud
my-external-ip/nextcloud
but still not with just
nextcloud.mydomain.com which is what all my existing sync clients are set up on.
I will update this post if I figure this last bit out.
-
Still can't get it working. Anyone have any ideas on how to get it working without having to use the /nextcloud directory after the domain? Not sure what the proper way to add it as a virtual host might be.
-
Is what I'm trying to achieve possible?
-
that is how it is configured on my SME9 that is awaiting migration.
# db domains show mycloud.mydomain.com
mycloud.mydomain.com=domain
Content=Primary
Description=Nextcloud
DocumentRoot=/usr/share/nextcloud
Nameservers=internet
RequireSSL=enabled
TemplatePath=WebAppVirtualHost
letsencryptSSLcert=enabled
# config show nextcloud
nextcloud=service
AdminPassword=REDACTED
AdminUser=REDACTED
CloudDomain=mycloud.mydomain.com
DbName=REDACTED
DbPassword=REDACTED
DbUser=REDACTED
ExcludeIbay=Primary,arch,rep
PHPBaseDir=/media/video/:/home/e-smith/files/ibays/music/files
TrustedDomains=
access=public
status=enabled
updater.secret=REDACTED
and I get in httpd.conf
<VirtualHost 0.0.0.0:80>
ServerName mycloud.mydomain.com
ServerAlias REDACTED
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
RewriteRule ^/(.*|$) https://%{HTTP_HOST}/$1 [L,R]
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
# alias for Apache icons
Alias /icons/ /var/www/icons/
DocumentRoot /usr/share/nextcloud
</VirtualHost>
<VirtualHost 0.0.0.0:443>
ServerName mycloud.mydomain.com
ServerAlias REDACTED
SSLEngine on
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
# alias for Apache icons
Alias /icons/ /var/www/icons/
DocumentRoot /usr/share/nextcloud
</VirtualHost>
starting sme10 /etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost/ is provided by core and does not need smeserver-webapps-common contrib.
beware to typo, and also declaration of domain using cli is mandatory, at least to define the TemplatePath=WebAppVirtualHost
-
My config shows the following:
# db domains show nextcloud.mymaindomain.com
nextcloud.mymaindomain.com=domain
Content=Primary
Description=Nextcloud
DocumentRoot=/usr/share/nextcloud
Nameservers=internet
RequireSSL=enabled
TemplatePath=WebAppVirtualHost
letsencryptSSLcert=enabled
# config show nextcloud
nextcloud=service
AdminPassword=REDACTED
AdminUser=REDACTED
CloudDomain=nextcloud.mymaindomain.com
DbName=REDACTED
DbPassword=REDACTED
DbUser=REDACTED
TrustedDomains=
VirtualHost=nextcloud.mymaindomain.com
access=public
status=enabled
Yet I have no VirtualHost entries for nextcloud.mymaindomain.com in /etc/httpd/conf/httpd.conf, but just mymaindomain.com and the other domains I have entered via the servermanager web interface do have VirtualHost entries. Could another contrib be blocking it from expanding properly?
-
expand-template /etc/httpd/conf/httpd.conf
any error ?
-
Ah yes, that does give errors.
# expand-template /etc/httpd/conf/httpd.conf
ERROR in /etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives: Program fragment delivered error <<syntax error at /etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives line 5, near "){"
syntax error at /etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives line 23, near "}
}">> at template line 1
WARNING in /etc/e-smith/templates//etc/httpd/conf/httpd.conf/80VirtualHosts: ERROR: Template processing failed for //etc/httpd/conf/httpd.conf/WebAppVirtualHost: 1 fragment generated errors
at /etc/e-smith/templates//etc/httpd/conf/httpd.conf/80VirtualHosts line 40.
ERROR in /etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives: Program fragment delivered error <<syntax error at /etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives line 5, near "){"
syntax error at /etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives line 23, near "}
}">> at template line 1
WARNING in /etc/e-smith/templates//etc/httpd/conf/httpd.conf/80VirtualHosts: ERROR: Template processing failed for //etc/httpd/conf/httpd.conf/WebAppVirtualHost: 1 fragment generated errors
at /etc/e-smith/templates//etc/httpd/conf/httpd.conf/80VirtualHosts line 40.
WARNING: Template processing succeeded for //etc/httpd/conf/httpd.conf: 2 fragments generated warnings
at /sbin/e-smith/expand-template line 45.
I wonder if it has something to do with LetsEncrypt.
-
/etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives
is part of smeserver-php
please raise a bug.
-
/etc/e-smith/templates//etc/httpd/conf/httpd.conf/WebAppVirtualHost/25SSLDirectives
is part of smeserver-php
please raise a bug.
Thanks, done.
https://bugs.koozali.org/show_bug.cgi?id=11641
-
Lastly, could you verify which template or configuration key/value I should put the following (if supported)?
'overwrite.cli.url' => 'https://nextcloud.mymaindomain.com',
'htaccess.RewriteBase' => '/',
Thank you!
[edit]
Trying to achieve https://docs.nextcloud.com/server/20/admin_manual/installation/source_installation.html?highlight=root%20domain#pretty-urls
I guess I can just edit config.php directly like in that link since there is no /etc/e-smith/templates/usr/share/nextcloud/?
-
i am not there yet. if you manage to fix this go and explain how and i will implement it.
-
To remove the index.php-part in all Nextcloud URLs I added
'overwrite.cli.url' => 'https://nextcloud.mymaindomain.com',
'htaccess.RewriteBase' => '/',
to /usr/share/nextcloud/config/config.php and then ran
occ maintenance:update:htaccess
to activate those new config changes.
The two lines are a little different if you don't use a dedicated hostname and instead access your Nextcloud with yourdomain.com/nextcloud. See https://docs.nextcloud.com/server/20/admin_manual/installation/source_installation.html?#pretty-urls for details.
Everything seems to be working very well. As long as config.php doesn't get overwritten it seems it should continue to work.