Install Nextcloud into root-directory of my Domain

I was checking again, now it work. I also found the error:
Instead of copying the old .htaccess file, I accidentally moved it (so there was no original one).

Is this resolved? Did you backup the .htaccess before?

Absolutely fresh install. Didn’t touch anything before/after enabling pretty URLs and running the occ command.

I resolved by copying in everything above “do not edit” from my production environment and saving.

Thank you :slight_smile: Your new guide works for the Force-SSL things. I have now pretty URLs etc. under my root-directory. Data is stored in /var/cloud-data :wink: The only problem is, that videos are not playable :grin: My log:

Error	index	Exception: {"Exception":"RedisException","Message":"Redis server went away","Code":0,"Trace":"#0 \/var\/www\/html\/nextcloud\/lib\/private\/Memcache\/Redis.php(114): Redis->incrBy('8a73d596d967558...', 1)\n#1 \/var\/www\/html\/nextcloud\/lib\/private\/Lock\/MemcacheLockingProvider.php(73): OC\\Memcache\\Redis->inc('files\/d5c46342e...')\n#2 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/Storage\/Common.php(651): OC\\Lock\\MemcacheLockingProvider->acquireLock('files\/d5c46342e...', 1)\n#3 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(584): OC\\Files\\Storage\\Common->acquireLock('files\/Documents...', 1, Object(OC\\Lock\\MemcacheLockingProvider))\n#4 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(584): OC\\Files\\Storage\\Wrapper\\Wrapper->acquireLock('files\/Documents...', 1, Object(OC\\Lock\\MemcacheLockingProvider))\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/View.php(1910): OC\\Files\\Storage\\Wrapper\\Wrapper->acquireLock('files\/Documents...', 1, Object(OC\\Lock\\MemcacheLockingProvider))\n#6 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/View.php(2013): OC\\Files\\View->lockPath('\/Documents\/Abou...', 1, false)\n#7 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/View.php(1106): OC\\Files\\View->lockFile('\/Documents\/Abou...', 1)\n#8 \/var\/www\/html\/nextcloud\/lib\/private\/Files\/View.php(963): OC\\Files\\View->basicOperation('fopen', '\/Documents\/Abou...', Array, 'r')\n#9 \/var\/www\/html\/nextcloud\/lib\/private\/Preview\/TXT.php(48): OC\\Files\\View->fopen('\/Documents\/Abou...', 'r')\n#10 \/var\/www\/html\/nextcloud\/lib\/private\/Preview.php(1142): OC\\Preview\\TXT->getThumbnail('\/Documents\/Abou...', 2048, 2048, false, Object(OC\\Files\\View))\n#11 \/var\/www\/html\/nextcloud\/lib\/private\/Preview.php(777): OC\\Preview->generatePreview(5)\n#12 \/var\/www\/html\/nextcloud\/lib\/private\/Preview.php(802): OC\\Preview->getPreview()\n#13 \/var\/www\/html\/nextcloud\/core\/ajax\/preview.php(64): OC\\Preview->showPreview()\n#14 \/var\/www\/html\/nextcloud\/lib\/private\/Route\/Route.php(155) : runtime-created function(1): require_once('\/var\/www\/html\/n...')\n#15 [internal function]: __lambda_func()\n#16 \/var\/www\/html\/nextcloud\/lib\/private\/Route\/Router.php(293): call_user_func('\\x00lambda_20', Array)\n#17 \/var\/www\/html\/nextcloud\/lib\/base.php(967): OC\\Route\\Router->match('\/core\/preview.p...')\n#18 \/var\/www\/html\/nextcloud\/index.php(48): OC::handleRequest()\n#19 {main}","File":"\/var\/www\/html\/nextcloud\/lib\/private\/Memcache\/Redis.php","Line":114}	2016-08-31T12:01:44+00:00	admin
Error	PHP	Cannot modify header information - headers already sent by (output started at /var/www/html/nextcloud/3rdparty/sabre/http/lib/Sapi.php:83) at /var/www/html/nextcloud/3rdparty/sabre/http/lib/Sapi.php#63	2016-08-31T11:56:16+00:00	admin
Error	PHP	Cannot modify header information - headers already sent by (output started at /var/www/html/nextcloud/3rdparty/sabre/http/lib/Sapi.php:83) at /var/www/html/nextcloud/3rdparty/sabre/http/lib/Sapi.php#58	2016-08-31T11:56:16+00:00	admin

Lol, Redis server went away. Hopefully it comes back soon?

Is Redis up and running OK? Check your system logs for clues as Redis is a system package.

I am running this instance on a 512 MB RAM Server with 1 Core. Is it possible, that there is not enough resources left for redis?!

In order to know, we’d really need to see what it’s doing.

As you’re on 16.04, what does the output of sudo systemctl status redis give you? Mine looks like:

● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2016-08-29 18:15:42 BST; 2 days ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 297 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server.post-up.d (code=exited,     status=0/SUCCESS)
  Process: 294 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
  Process: 287 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d (code=exited,     status=0/SUCCESS)
 Main PID: 296 (redis-server)
    Tasks: 3
   Memory: 6.2M
      CPU: 8min 16.858s
   CGroup: /system.slice/redis-server.service
          └─296 /usr/bin/redis-server 127.0.0.1:0

Furthermore, what do you see in sudo less /var/log/redis/redis-server.log and sudo less /var/log/syslog ?

Thank you for your reply @JasonBayton

Here is my status:
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor pre
Active: active (running) since Wed 2016-08-31 12:03:39 UTC; 22h ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 2307 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server.p
Process: 2303 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exit
Process: 2284 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.pr
Main PID: 2306 (redis-server)
Tasks: 3
Memory: 1.5M
CPU: 2min 15.237s
CGroup: /system.slice/redis-server.service
└─2306 /usr/bin/redis-server 127.0.0.1:0

My log:

3158:C 31 Aug 14:40:55.085 * RDB: 0 MB of memory used by copy-on-write
2306:M 31 Aug 14:40:55.171 * Background saving terminated with success
2306:M 31 Aug 15:18:37.755 * 1 changes in 900 seconds. Saving...
2306:M 31 Aug 15:18:37.756 * Background saving started by pid 3292
3292:C 31 Aug 15:18:37.758 * DB saved on disk
3292:C 31 Aug 15:18:37.759 * RDB: 0 MB of memory used by copy-on-write
2306:M 31 Aug 15:18:37.856 * Background saving terminated with success
2306:M 31 Aug 15:23:38.058 * 10 changes in 300 seconds. Saving...
2306:M 31 Aug 15:23:38.060 * Background saving started by pid 3300
3300:C 31 Aug 15:23:38.064 * DB saved on disk
3300:C 31 Aug 15:23:38.065 * RDB: 0 MB of memory used by copy-on-write
2306:M 31 Aug 15:23:38.160 * Background saving terminated with success
2306:M 31 Aug 21:37:58.092 * 1 changes in 900 seconds. Saving...
2306:M 31 Aug 21:37:58.093 * Background saving started by pid 6169
6169:C 31 Aug 21:37:58.096 * DB saved on disk
6169:C 31 Aug 21:37:58.096 * RDB: 0 MB of memory used by copy-on-write
2306:M 31 Aug 21:37:58.193 * Background saving terminated with success
2306:M 01 Sep 10:51:58.217 * 1 changes in 900 seconds. Saving...
2306:M 01 Sep 10:51:58.218 * Background saving started by pid 10080
10080:C 01 Sep 10:51:58.222 * DB saved on disk
10080:C 01 Sep 10:51:58.222 * RDB: 0 MB of memory used by copy-on-write
2306:M 01 Sep 10:51:58.318 * Background saving terminated with success

The second requested log:

    Sep  1 09:09:01 cloud CRON[8853]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
Sep  1 09:17:01 cloud CRON[8969]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Sep  1 09:39:01 cloud CRON[9180]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
Sep  1 10:09:01 cloud CRON[9548]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
Sep  1 10:17:01 cloud CRON[9709]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Sep  1 10:39:01 cloud CRON[9918]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
Sep  1 11:00:55 cloud systemd[1]: Created slice User Slice of root.
Sep  1 11:00:55 cloud systemd[1]: Starting User Manager for UID 0...
Sep  1 11:00:55 cloud systemd[1]: Started Session 74 of user root.
Sep  1 11:00:55 cloud systemd[10171]: Reached target Paths.
Sep  1 11:00:55 cloud systemd[10171]: Reached target Sockets.
Sep  1 11:00:55 cloud systemd[10171]: Reached target Timers.
Sep  1 11:00:55 cloud systemd[10171]: Reached target Basic System.
Sep  1 11:00:55 cloud systemd[10171]: Reached target Default.
Sep  1 11:00:55 cloud systemd[10171]: Startup finished in 36ms.
Sep  1 11:00:55 cloud systemd[1]: Started User Manager for UID 0.

Hmm, nothing obvious at all, are your NC logs still telling you the server went away?

What does your redis config file look like? Are you using the unix socket?

Hi @JasonBayton, thanks for the guide, as someone without much experience with running websites, it was really great to be able to go step-by-step through everything.
But unfortunately, I have this same problem - when I upload a file from the browser, it fails with the message “Error uploading file “example.file”: Redis server went away”

When I check the Log in the Admin section, the error messages all say:

Redis::connect(): php_network_getaddresses: getaddrinfo failed: 
Name or service not known at /var/www/html/nextcloud/lib/private/RedisFactory.php#61					

I can’t work out what I should be checking on - Redis is definitely the part of the process where I have the least understanding of what it is, how it works, and how to solve problems. Do you have any suggestions?

Here is my redis.conf
and systemstl status redis gives:

● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-09-15 20:46:56 CEST; 1 day 17h ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
 Main PID: 3606 (redis-server)
   CGroup: /system.slice/redis-server.service
           └─3606 /usr/bin/redis-server 127.0.0.1:6379       

Sep 15 20:46:56 ubuntuserver systemd[1]: Starting Advanced key-value store...
Sep 15 20:46:56 ubuntuserver run-parts[3601]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_e
Sep 15 20:46:56 ubuntuserver run-parts[3607]: run-parts: executing /etc/redis/redis-server.post-up.d/00_
Sep 15 20:46:56 ubuntuserver systemd[1]: Started Advanced key-value store.
...skipping...
● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-09-15 20:46:56 CEST; 1 day 17h ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
 Main PID: 3606 (redis-server)
   CGroup: /system.slice/redis-server.service
           └─3606 /usr/bin/redis-server 127.0.0.1:6379       

Sep 15 20:46:56 ubuntuserver systemd[1]: Starting Advanced key-value store...
Sep 15 20:46:56 ubuntuserver run-parts[3601]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_e
Sep 15 20:46:56 ubuntuserver run-parts[3607]: run-parts: executing /etc/redis/redis-server.post-up.d/00_
Sep 15 20:46:56 ubuntuserver systemd[1]: Started Advanced key-value store.

@MariusBluem & @cameralibre

I’ll spin up a test instance on a fresh container this weekend and see if I can replicate this. I’d output my redis conf in the meantime but my home server is in bits :slight_smile:

Just wondering if there was any followup with this topic. I also am getting this same error message:

Error PHP RedisException: Redis server went away at /var/www/html/CLOUDDIRECTORY/lib/private/Memcache/Redis.php#114

And when running: sudo systemctl status redis, I’m getting the same result as @cameralibre and it appears it’s running perfectly fine, so the error message is a bit confusing.

Yes I’ve spun up two additional installs with Redis and haven’t seen the issue on my side.
Each time following this:

sudo vim /etc/redis/redis.conf

Now, find and change:

port 6370 to port 0

Then uncomment:

unixsocket /var/run/redis/redis.sock
unixsocketperm 700 changing permissions to 770 at the same time: unixsocketperm 770

Save and quit, then add the Redis user redis to the www-data group:

sudo usermod -a -G redis www-data

Thanks for the quick reply, Jason!

Quick question…what does the Redis portion of your config file(config/config.php) look like? Do you use Port 0 and the Unix Socket settings or the Port 6379 and localhost settings for Redis in your config file?

Here are the relevant bits in my setup(s):

redis.conf:

# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
port 0

# TCP listen() backlog.
#
# In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connections issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
tcp-backlog 511

# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
bind 127.0.0.1

# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
unixsocket /var/run/redis/redis.sock
unixsocketperm 770

nc config.php:

'memcache.local' => '\\OC\\Memcache\\APCu',
'filelocking.enabled' => 'true',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
   'host' => '/var/run/redis/redis.sock',
   'port' => 0,
   'timeout' => 0.0,
),

How does that compare with yours?

Prior to my last message, this is how my configs were setup:

redis.conf

# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
port 0

# TCP listen() backlog.
#
# In high requests-per-second environments you need an high backlog in order
# to avoid slow clients connections issues. Note that the Linux kernel
# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# in order to get the desired effect.
tcp-backlog 511

# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# interfaces using the "bind" configuration directive, followed by one or
# more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
bind 127.0.0.1

# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
unixsocket /var/run/redis/redis.sock
# unixsocketperm 770 

Nextcloud config/config.php

'memcache.local' => '\OC\Memcache\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' => 
  array (
      'host' => '/var/run/redis/redis.sock',
      'port' =>  0,
      'timeout' => 0.0,
   ),

With these settings, I was getting the “Redis server went away” error message and a Redis error in reference to the Gallery app. In what I thought was an unrelated issue, my ability to share a file also wasn’t working(my Sharing text box where the user I’m in process of sharing a file with was greyed out and “Resharing is not allowed” was being displayed in this Sharing text box.

After I sent my last message, I quickly referenced some other sites and stumbled onto a site that was having a similar discussion, suggesting the same redis.conf but some mods on config/config.php. Here is what is my new config/config.php:

  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' => 
  array (
       'host' => 'localhost',  // original value: /var/run/redis/redis.sock
       'port' => 6379,    // original value: 0
       'timeout' => 0.0,
   ),
);

Long story long…and after a trip to Macy’s, I returned home to find that I didn’t have any new error messages and my ability to share files to local users and to federated users had been restored. Now, I’d like to figure why these changes yielded such a positive result.

It looks like you’ve switched back from the unix socket to using TCP.

I notice you’ve left unixsocketperm commented out in your redis conf. Could that be the cause?

Yes, it could be.

When I woke up(yes, I know it’s almost 3:30 in the afternoon), I just checked my error log again, and still no errors.

I’m still going to keep digging, because I’m really trying to learn the “ins and out’s” of this system. And I’d really like to know why my error messages dropped off(not that I’m complaining). Thank you for your help, Jason!

Return it back to unix socket from TCP and make sure the permissions line isn’t commented out and is set correctly as per my config, then try again.

The issue isn’t with Redis by the looks of things, but by how NC has been trying to talk to it.

Hello Jayson!

Apologies for the delay in response, but I did implement your suggested changes, which fixed my original issue and also fixed another error message I was getting, “Redis Server went away”.

Following your suggested changes, I restarted Redis and Redis came back online with no more error messages, allowing me to resume uploading to my NC server.

To restart Redis for anyone who doesn’t know how:

/etc/init.d/redis-server restart

Thank you again for your help, bro!