[How-To] ownCloud using NGINX, PHP-FPM, and MySQL

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Hello, i know this might be a noobie question but i really don't want to mess with Nextcloud. I received a notification about NC 12.0.1 update but, when i click on the updater, i get a blank page: no errors, nothing in logs.

I would like to manually update, could you tell me how to do it in order to keep everything set up as it is?

Thank you.
 

ArgaWoW

Patron
Joined
Jul 4, 2015
Messages
444
Hello, i know this might be a noobie question but i really don't want to mess with Nextcloud. I received a notification about NC 12.0.1 update but, when i click on the updater, i get a blank page: no errors, nothing in logs.

I would like to manually update, could you tell me how to do it in order to keep everything set up as it is?

Thank you.
Hello,
- Stop your nextcloud jail
- back up your Config.php (usr/local/www/nextcloud/config/config.php)
- Download nextcloud and put it into the same place like the old one (usr/local/www/nextcloud/
- Copy back your config php.
- Enter your nextcloud homepage and do the database upgrade.

That's all. Worked for me this way.
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
I know it doesn't have anything to do with the time or date, but I wanted to be sure I didn't get a bum build or nightly etc.
Here's what I used as my source installation package for NextCloud 12:
Code:
fetch "https://download.nextcloud.com/server/releases/nextcloud-12.0.0.tar.bz2"
The link seems all right.
You could try installing version 12.0.1:

https://download.nextcloud.com/server/releases/nextcloud-12.0.1.tar.bz2

On the following page, you can validate your package integrity:

https://nextcloud.com/install/#instructions-server

This may not resolve the issue with the time server.
 

wxlsxn

Dabbler
Joined
May 19, 2017
Messages
29
The link seems all right.
You could try installing version 12.0.1:

https://download.nextcloud.com/server/releases/nextcloud-12.0.1.tar.bz2

On the following page, you can validate your package integrity:

https://nextcloud.com/install/#instructions-server

This may not resolve the issue with the time server.
I just tried from scratch for a 3rd time and using the 12.0.1 version...no such luck. Still bad timestamps, constant re-authentication for changes that loop endlessly and cannot make any headway. This sucks :confused:

Thanks for your help/input though!
 

wxlsxn

Dabbler
Joined
May 19, 2017
Messages
29
Just an update for anyone else running into my issue. I started over again but did all work from a CentOS 7 box and everything worked correctly afterwards. Beware Windows?
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Can you reinstall nextcloud from scratch and get it to use exisiting data from a previous install? If so what commands allow you to use your previous databases that is still available?
 

ArgaWoW

Patron
Joined
Jul 4, 2015
Messages
444
Can no one help me with this issue?

Come on guys

Update:

found the solution by adding

client_body_in_file_only clean;
client_body_buffer_size 32K;

# set max upload size
client_max_body_size 4000M;

into the nginx.conf of the proxy and nextcloud. Do someone know how to solve this error on the admin page (sorry for postion in german)

Code:
  • Der „X-XSS-Protection“-HTTP-Header ist nicht so konfiguriert, dass er „1; mode=block“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
  • Der „X-Content-Type-Options“-HTTP-Header ist nicht so konfiguriert, dass er „nosniff“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
  • Der „X-Robots-Tag“-HTTP-Header ist nicht so konfiguriert, dass er „none“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
  • Der „X-Frame-Options“-HTTP-Header ist nicht so konfiguriert, dass er „SAMEORIGIN“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
  • Der „X-Download-Options“-HTTP-Header ist nicht so konfiguriert, dass er „noopen“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.
  • Der „X-Permitted-Cross-Domain-Policies“-HTTP-Header ist nicht so konfiguriert, dass er „none“ entspricht. Dies ist ein potentielles Sicherheitsrisiko und es wird empfohlen, diese Einstellung zu ändern.

in my nginx.conf of the proxy and nextcloud I have the following:

Code:
	   add_header X-Xss-Protection "1; mode=block" always;
	   add_header X-Content-Type-Options "nosniff" always;
	   add_header Strict-Transport-Security "max-age=2592000; includeSubdomains" always;
	   add_header X-Frame-Options "SAMEORIGIN" always;
	   proxy_hide_header X-Powered-By;
	   add_header 'Referrer-Policy' 'no-referrer';
	   add_header Content-Security-Policy "frame-ancestors mydomain.eu;";



thanks for reply
Hello,
I have updated to V12. 02 and still the same error in the administration page.

Can someone help please

Thanks in advance
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Hello,
I have updated to V12. 02 and still the same error in the administration page.

Can someone help please

Thanks in advance
I suspect your nginx.conf is not complete or not written properly.
I see that the term "always" appear. The reference nginx.conf doesn'r contain it.

Can you make a backup of your nginx.conf file and start with the default one provided on the Nextcloud website?

https://docs.nextcloud.com/server/12/admin_manual/release_notes.html#updates-to-nginx-configuration
https://docs.nextcloud.com/server/12/admin_manual/installation/nginx.html
 

tamilmad

Dabbler
Joined
Oct 20, 2015
Messages
36
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")

I have just installed FreeNAS-11.0-U2 (e417d8aa5). (earlier I was on v10 and I had to return back to this version). I followed the guide as in first page. At this step
mysql -e "CREATE DATABASE owncloud;", I get the the above error.

As I browsed the thread, I foud a couple of suggestions for this , one being do a complete redo.( I did the same starting with freshly creating a dataset for the jails also, but I get the same error.)

The second suggestion by Joshua is to check whether Mysql is really running.

Please let me know how I can check if Mysql is running and any other ways to tackle the above error.

If you think I have asked a Noob question, please forgive me.
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
If you already have the database setup from an earlier version, then you do not nee to create the database again.
Make sure you jail storage are pointing to the proper datasets and that they are mounted.
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
I have follow all the guide but installing NextCloud12... It's working everything but my client have this problem:

Code:
server replied: Request Entity Too Large


I have search everywhere and it's a problem related tho the nginx.conf file.
I have add this 2 line in the server section of: /usr/local/etc/nginx/nginx.conf

Code:
fastcgi_buffers 64 4K;
client_max_body_size 4096M;


But I haven't solved my problem...
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Yo also have to modify your php.ini file as well.

Code:
upload_max_filesize = 4096M
post_max_size = 4096M
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
Yo also have to modify your php.ini file as well.

Code:
upload_max_filesize = 4096M
post_max_size = 4096M

Thanks! Have you solved my problem! ;)

I have added to my system a self-signed certificate... I want to use a Let's Encrypt one. Is there someone that have already done it?
Is this a good solution: https://github.com/Neilpang/acme.sh ?
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Just install certbot pkg install py27-certbot and set it up according to the docs.
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
Just install certbot pkg install py27-certbot and set it up according to the docs.
Thanks boss!

Now everything works. Is there a way to Force a redirect when someone try to reach the Port 80 and shifting it to the HTTPS one?

I have already try following this guide: https://www.cyberciti.biz/faq/linux-unix-nginx-redirect-all-http-to-https/
adding a server tag with:
Code:
listen	  80 default;
server_name my.domain.com
## redirect http to https ##
return	  301 https://$server_name$request_uri;


or with:

Code:
listen	  80;
server_name my.domain.com
## redirect http to https ##
rewrite	  ^	  https://$server_name$request_uri? permanent;
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Code:
return	 301 https://$host$request_uri;
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
Code:
return	 301 https://$host$request_uri;

I have added it in the server tag but when i try to reach the page i see an error for TOO MANY REDIRECTS... :(
 

HammyHavoc

Cadet
Joined
Sep 10, 2017
Messages
3
Hi all,

I go to start nginx manually (as it wasn't starting automatically due to a config issue), and this happens.

Code:
root@Nextcloud:/usr/local/etc/nginx # service nginx start					 
Performing sanity check on nginx configuration:								
nginx: [emerg] location "^/nextcloud/(?:\.|data|config|db_structure\.xml|README)
" is outside location "/nextcloud" in /usr/local/etc/nginx/nginx.conf:47		
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed		 
Starting nginx.																
nginx: [emerg] location "^/nextcloud/(?:\.|data|config|db_structure\.xml|README)
" is outside location "/nextcloud" in /usr/local/etc/nginx/nginx.conf:47		
/usr/local/etc/rc.d/nginx: WARNING: failed to start nginx					 


Here's my nginx.conf, copied from an early post by someone else, and modified to include nextcloud rather than owncloud, which is what I've modified the tutorial to install:

Code:
#user  nobody;
worker_processes  8;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid  logs/nginx.pid;
events {
  worker_connections  1024;
}
http {
  include  mime.types;
  default_type  application/octet-stream;
  #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  #  '$status $body_bytes_sent "$http_referer" '
  #  '"$http_user_agent" "$http_x_forwarded_for"';
  #access_log  logs/access.log  main;
  sendfile  on;
  tcp_nopush  on;
  #keepalive_timeout  0;
  keepalive_timeout  65;
  gzip  on;
  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 9;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  server {
  root /usr/local/www;
  location = /robots.txt { allow all; access_log off; log_not_found off; }
  location = /favicon.ico { access_log off; log_not_found off; }
  location ^~ /nextcloud {
  index index.php;
  try_files $uri $uri/ /index.php?$args;
  client_max_body_size 512M;
  location ~ ^/nextcloud/(?:\.|data|config|db_structure\.xml|README) {
  deny all;
  }
  rewrite ^/nextcloud/apps/([^/]+)/(.+\.(css|php))$ /nextcloud/index.php?app=$1&getfile=$2 last;
  rewrite ^/nextcloud/remote/(.*)$ /nextcloud/remote.php/$1 last;
  location ~ \.php/? {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php-fpm.sock;
  include fastcgi_params;
  }
  location ~* \.(?:jpg|gif|ico|png|css|js|svg)$ {
  expires max; add_header Cache-Control public;
  }
  }
}



Any help would be massively appreciated. Frustrated trying to get Nextcloud up and running. I'm sure it's something really silly. At this point I just want to get on with working instead of configuring things.

All the best,
Hammy
 

Jacopx

Patron
Joined
Feb 19, 2016
Messages
367
Buongiorno a tutti!

My installation of NextCloud works perfectly... From some days i see the notification of update available, if i try to go to the admin page and select Open Updater nothing happen. Someone can help me? There's a way to do the update manually?
 
Top