Iphone 5se says it can't connect to Debian Jessie server

I have the server and client installed on my laptop. I have the client on my iphone. I can login to nextcloud on the laptop. But the iphone keeps insisting it can’t see the server.

I enter IP (https://192.168.0.52/nextcloud/) and username and password. If I use http instead of https, then in addition to saying it can’t find the server, it says “Request failed: unauthorized (401)”

This is on my home network. Both devices are on the same subnet.

It seems to me this has to be a permissions problem somewhere, but I have no idea what to tweak. Or maybe there’s a config file I need to edit?

I hope someone can help because this has been megafrustrating.

Hm. Do you have Pretty-Urls enabled? That was necessary for my iOS device to connect

Access/error logs for the webserver might show the problem too

Jason, this seems like the releavant line out of the error.log: [:error] [pid 22876] [client 192.168.0.3:50213] script '/var/www/html/remote.php' not found or unable to stat

Not sure what to do about that. There is indeed no such script in that directory. Can I download it somewhere and just put it there? What could have caused it to be missing??

Hollerauer: Where would I enable Pretty-Urls? That would be a nice simple solution, if it worked!

I found a remote.php under /var/www/nextcloud/. So I tried copying that to /var/www/html/ (as root of course), but it doesn’t help matters.

Looking at config.php in /var/www/nextcloud/config/, it looks like this line 'htaccess.RewriteBase' => '/' may be necessary to point to web root, so I added that to config.php as 'htaccess.RewriteBase' => '/nextcloud' since that’s where my nextcloud seems to be. Doesn’t seem to do anything. I restarted apache, but I’m not sure how you restart nextcloud.

How do you restart nextcloud?

I’ll try turning everything off an on again, but it would be nice to know a more elegant method.

As for Pretty-Urls, I’m stuck. I searched and searched, but it seems to go somewhere in the config files for a given package or for apache. Not even sure about that. So I’d definitely need a specific line and which config file it goes in.

So far, I’m as far away as ever :frowning:

sudo systemctl restart httpd.service

Hey, thanks Hollerauer.When I try restart http.service, I just get an error message. “…failed to load. No such file or service.”

By the way, how do you enable PrettyUrls?

And if my install is in /var/www/html/nextcloud am I right in thinking this 'htaccess.RewriteBase' => '/nextcloud' is the correct change to make to the nextcloud config file?

Still struggling with this. Not constantly, of course. It’s too frustrating for that.

What I’m getting now is a 500 error on the phone when I try to connect. (Nextcloud comes up normally on my laptop browser.)

Googling around, it seems the likeliest reason to get a 500 error is that the permissions are wrong on my server (i.e. my laptop).

The directories are all 750 (dwrxr-x—) and the files, including all scripts, are all 640 (rw-r-----). I didn’t change anything there post installation. Owner is mostly root. Group is www-data.

I’m reluctant to do a global change permissions on the files to 755 (rwxr-xr-x) which is what I’ve seen recommended for a 500 error. There are a lot of files, and some of them surely have very restricted permissions for a reason. Right?

Can anyone out there tell me what’s a safe way to proceed without just setting the whole damn thing to 777??

Try a sudo service apache2 restart or sudo service httpd restart

Guide

As long as you access it like: server.com/nextcloud

Webserver (not NC) error log should give you a reason for a 500.

Seems fine, don’t change the perms.

Change this to www-data as the owner.

JasonBayton, thank you for that very detailed answer. Working my way through it now.

I think at least part of the problem is that nextcloud is looking for executables in the wrong place.

While owner was still root: I had this error message in apache’s error.log:

PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
PHP Fatal error:  Unknown: Failed opening required '/var/www/html/remote.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

There’s only an index.php in my /var/www/html/ but I copied remote.php from /var/www/nextcloud to /var/www/html and changed owner and group to www-data.

Now the error message is:

PHP Warning:  require_once(/var/www/html/lib/base.php): failed to open stream: No such file or directory in /var/www/html/remote.php on line 110
PHP Fatal error:  require_once(): Failed opening required '/var/www/html/lib/base.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/remote.php on line 110

Now it gets as far as line 110, and it’s missing “base.php” presumably the next script it needs? So it’s looking in the wrong place?

How do I tell it where to look? I think I’ve already done that with ‘htaccess.RewriteBase’ => ‘/nextcloud/’ but I’m still getting that error message. Aargh!

Oh, also, is it enough to just restart apache after changes? Do I need to reboot the phone after each change? (I hope not! I tried that once and it didn’t seem to make a difference.) Presumably I don’t have to reboot the laptop/server?

Tried a few more things. Now I’m getting a new error message:

This Nextcloud instance is currently in maintenance mode, which may take a while.

That just started on its own.I’m not aware of having done or changed anything.

the error log says only:

[Thu Oct 26 20:21:13.951845 2017] [mpm_prefork:notice] [pid 32103] AH00163: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Thu Oct 26 20:21:13.951918 2017] [core:notice] [pid 32103] AH00094: Command line: '/usr/sbin/apache2

Would reinstalling be worth trying? Or is that just going to lead into the same weeds? I really need to get this working if I’m to use that blankety-blank iphone.

reinstalled in a terminal which gave me some useful info on running “occ”. It even gave a url: https://docs.nextcloud.com/server/12/admin_manual/maintenance/upgrade.html, which led to https://docs.nextcloud.com/server/12/admin_manual/configuration_server/occ_command.html

Ran occ, did an upgrade, took it out of maintenance mode, and …

it works!

Calloo! Callay!

If I might make a suggestion, those helpful messages need to appear in the GUI interface.