Opensuse 15.2 - postgresql - apache - php-fpm - nextcloud

Hello!
I am trying to install Nextcloud on opensuse 15.2 with postgresql, apache and php-fpm
I follow the official docs from nextcloud site and some blogs and all seems ok
But, after finish and try Up the service, it show in web browser:
apache up ok
postgresql up ok
php-fpm pk

so, I try http://10.1.1.2

and get the error:

Object not found

the requested URL was not found on this server. If you entered the address (URL) manually, please double check the address syntax. If you believe you have encontered a problem with the server please contact the webmaster.

Versions:

OpenSUSE 15.2
PHP 7.4.6
Postgresql 12
Apache/2.4.43

firewalld: ports 80, 5432 open

Pictures:

apache status
Imgur

php-fpm
Imgur

postgresql
Imgur

Please, Somebody Can I help me?

Thank you

Douglas

Hmm, struggeling myself too with the Nextcloud / Opensuse (15.3) runlevel3, headless / LetsEncrypt / ExoticPortNumber combination. Configured ssh on [exotic_port] as well.

Started with installed NextCloud on OpenSuse15.2, ran on port 80, worked fine. Except for those intriging hints to resolve to ssl / https…

But on OS Upgrade to 15.3 Nextcloud got downgraded from the official repo. Fixed that with installing a fresh zip with copied config.php from backup (cloud-data was not in /srv/www/htdocs/nextcloud). Stil not TLS, but still working.

PortSharing on modem/router is set up for host on 80 / 443 to allow certbot (needs open port 80/443 combo for renewal, port not configurable ( to [exotic_port]>?)
Created a separate vhost dead-end site on port 80.

Downloaded/installed python3-certbot-apache (v1.4.0) and ran it with the -apache option.
So now I have a certificate and site running on https…

From forum posts I figured that OpenSuse is a bit different than other distro’s:
installed nextcloud is in /etc/apache2/conf.d/nextcloud.conf (not in …/vhosts.d)

In the dummy-site file vhosts.d/dummy.conf certbot added:

RewriteEngine on
RewriteCond %{SERVER_NAME} =myhost_subdomain.domain.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

in the VirtualHost section. And a copy was made into vhosts.d/dummy-le-ssl.conf with these added lines:

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/myhost_subdomain.domain.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/myhost_subdomain.domain.net/privkey.pem

So I figured that the /etc/apache2/conf.d/nextcloud.conf also needs some kind of path to the certificate and maybe even rewrite hints?
The file starts with:

Alias /nextcloud "/srv/www/htdocs/nextcloud/"
Alias / "/srv/www/htdocs/nextcloud/"
ServerName myhost_subdomain.domain.net

and in the rewrite section I added those two lines as the last rules and finally the certificate paths

...
  RewriteCond %{SERVER_NAME} =myhost_subdomain.domain.net
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</IfModule>
SSLCertificateFile /etc/letsencrypt/live/myhost_subdomain.domain.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/myhost_subdomain.domain.net/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

In /etc/apache2/listen.conf and /etc/apache2/listen_nss.conf added underneath listen 443 also my [exotic_port] (and keyword https).

When in the browser I go to

http://myhost_subdomain.domain.net:80

this sends me to

https://myhost_subdomain.domain.net/error/HTTP_BAD_REQUEST.html.var

which shows me an apache2 error page. Note: redirect to https but no nextcloud page. Probably I was to be led to my dummy vhost page, but that one is broken somehow…

https://myhost_subdomain.domain.net:[exotic_port]

sends me to

https://myhost_subdomain.domain.net/index.php/login

→ So no port number shown… and I am unsure on what port I do connect… when I only allow [exotic_port] in nextcloud.conf I do get the error

Access through untrusted domain

So it appeared to be 443 (which I had open when I tried). So to fix - I need to rewrite the URL to something including the [exotic_port]. Now I added in my config.php

 'trusted_domains' =>
  array (
    0 => 'myhost_subdomain.domain.net:[exotic_port]',
  ),
  'overwritehost' => 'myhost_subdomain.domain.net:[exotic_port]',
  'overwrite.cli.url' => 'https://myhost_subdomain.domain.net:[exotic_port]/',
  'overwriteprotocol' => 'https',
);

Note: replace [exotic_port] with your portnumber

Although in the browser the [exotic_port] is not shown (connection via 443 [>?] is listened to), but internally redirected to port [exotic_port] ???

In the end, it works and on TLS / https… on an [exotic_port] number.

Sorry , but based on what you describe here, it does not work. It connects via port 443. Otherwise it would show up in the browser. You have to specify a diffrent port explicitly in the URL, otherwise it connects via the default ports 80/443. Furthermore the entries in the config.php have no influence on which port you connect over. The web server manages this. If you want your Nextcloud to be reachable on a different port, you have to configure your Apache VirtualHost to a different port…

https://serverfault.com/questions/246445/how-do-i-create-virtual-hosts-for-different-ports-on-apache

…but then certbot will not work for these virtual hosts. I would abandon this “Exotic Port Project” and just use the default ports. Security by obscurity has never been an adequate way to protect services. And if you are not confident enough that the your cloud is configured securely, put it behind a VPN. Another port won’t protect you anyways, if someone really tries to get in.

Hello!
Thanks all aswers. I am still trying to build my Nextcloud. I tryed with NGINX too. With NGINX its access first time when you need to complete last informations to nextcloud UP. So, when I give the infos its trys to finnish installation and frezze/stop. In second time simple it does not let access never more tell me:

Internal server error!
Forever

seeing the logs. tell about pemission connect. problem. I will try to simulate again and post the log here!

Thank you

I use MariaDB as a database, but you use other database software.

  • Can you access the dataabase with the database management software?
    ** Did you set a database (root) password and is that password in the config.php file?
    ** Can you connect with those credentials listed there?
    ** Can you also connect as the “nextcloud” database user?
    ** Did you grant the right permissions?

I put my cloud data under a separate directory under /

  • Where did you put the cloud files, so the data of the cloud installation?
    ** Is that under the /srv/www/htdocs/nextcloud directory or in a separate directory tree?
    ** Did you set the permissions right (chown / chmod) for the apache webuser wwwrun:www?

There are several tools online to test your server:

Hello!
How are you?

Sorry not answer until now.

I use MariaDB as a database, but you use other database software.
Yes, I use Postgresql

  • Can you access the dataabase with the database management software?
    How can I do this?

** Did you set a database (root) password and is that password in the config.php file?
Yes, I do!

** Can you connect with those credentials listed there?
As I tell you. After try second time It does not let acceess more

** Can you also connect as the “nextcloud” database user?
Can you explain me how, please?

** Did you grant the right permissions?
Yes, I do

I put my cloud data under a separate directory under /

  • Where did you put the cloud files, so the data of the cloud installation?
    The server still a test server so I did put in /srv/ncdata but after when it will in production will be out path server

** Is that under the /srv/www/htdocs/nextcloud directory or in a separate directory tree?
Its under /opt/nextcloud

** Did you set the permissions right (chown / chmod) for the apache webuser wwwrun:www?
Yes, many many times

So, I change the Distro now. I get Oracle Linux 8.4. Now I can test NGINX with simple html test and php-fpm 7.4. In OpenSUSE many troubles, only to do simple test php-fpm. I Like OpenSUSE but for Nextcloud it is not good choice (until now for me of course). I am a long long time try to do Nextcloud works in OpenSUSE, first with 15.2 and the last 15.3 Leap. Try follow many blogs, sites over the world. Little docs. ahhhh, yes, There is too Many docs Nextcloud-Ubuntu but, not! Still do not preffer Ubuntu.

Thanks attention and Help

There are several tools online to test your server: