HOW-TO: NextCloud 10 w/ Apache, PHP, and MariaDB

Status
Not open for further replies.

BlinkyBill

Cadet
Joined
Nov 2, 2015
Messages
5
I'm stuck on the "Configure PHP.INI" step.
There is no /usr/local/etc/php.ini file. Entering ls tells me that I have a php.ini-development file, a php.ini-production file & a folder called php with a number of ext- ..... .ini files, but no php.ini.

Entering php -ver via PuTTy yields that I have PHP 7.0.12 installed.
I also tried typing find / -name php.ini with no results returned.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Run the following then make your edits
cd /usr/local/etc
cp php.ini-production php.ini
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Configure REDIS
Update /usr/local/etc/redis.conf to run on local socket

Find port= and change it to 0

Find and replace:

Code:
unixsocket /tmp/redis.sock
unixsocketperm 750


Add REDIS to rc.conf
$ sysrc redis_enable=yes

Start REDIS
$ service redis start

Run ls -al /tmp to run on local socket, you should see redis.sock and mysql.sock in the list.

If you see those two, you're ALMOST DONE!!


I wanted to thank you for the great guide, it's super easy to follow and so far i was able to troubleshoot everything with no difficulties exept for REDIS. I followed the guide but when i try to find "port=" i won't get any match, i do if i look for "port": i just set the line as "port 0". So far so good, i can start REDIS. When i run
Code:
ls -al /tmp
i only see "mysql.sock". Tried to reach the end of the guide anyway but when i go on 192.168.1.99 i keep seeing "It works!"

Any idea? Thanks again.
 

nathank1989

Contributor
Joined
Aug 29, 2016
Messages
103
I wanted to thank you for the great guide, it's super easy to follow and so far i was able to troubleshoot everything with no difficulties exept for REDIS. I followed the guide but when i try to find "port=" i won't get any match, i do if i look for "port": i just set the line as "port 0". So far so good, i can start REDIS. When i run
Code:
ls -al /tmp
i only see "mysql.sock". Tried to reach the end of the guide anyway but when i go on 192.168.1.99 i keep seeing "It works!"

Any idea? Thanks again.
If you're see the It Works page, it means Apache hasn't been configured to point to the Nextcloud installation. Make sure you don't skip a step. Each one is important.
I looked at my redis.conf and it does not have the '=' so I will edit the post to reflect that.

Type service redis status and if you get a PID number it means it's running. Try going through the redis setup again.

Here's a pic of my redis.conf file with the area in question

So check thAt your Apache configuration is set up to point to where your nextcloud is installed at.
Make sure nextcloud is downloaded and extracted to the right place
Make sure you start the redis server service redis start and that it's in your /etc/rc.conf. File

And in redis.conf try changing unix permissions to 755

(my guide mistakingly had 750, and when troubleshooting I changed it to 777 and forgot to change it to the recommended 755 so thank you for allowing me to catch that and change it ;) )
Needs to be 777 not 755

Hope this helps :)
 

Attachments

  • IMG_1911.PNG
    IMG_1911.PNG
    522.3 KB · Views: 701
Last edited:

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
If you're see the It Works page, it means Apache hasn't been configured to point to the Nextcloud installation. Make sure you don't skip a step. Each one is important.
I looked at my redis.conf and it does not have the '=' so I will edit the post to reflect that.

Type service redis status and if you get a PID number it means it's running. Try going through the redis setup again.

Here's a pic of my redis.conf file with the area in question

So check thAt your Apache configuration is set up to point to where your nextcloud is installed at.
Make sure nextcloud is downloaded and extracted to the right place
Make sure you start the redis server service redis start and that it's in your /etc/rc.conf. File

And in redis.conf try changing unix permissions to 755

(my guide mistakingly had 750, and when troubleshooting I changed it to 777 and forgot to change it to the recommended 755 so thank you for allowing me to catch that and change it ;) )

Hope this helps :)


Thanks for the answer, i tried removing redis and all its folders, then installed it again and followed the guide again. (quick stupid question, when you say to update redis.conf to run on local socket, you just mean to nano into it and modify the lines you talk about in the guide, right?). Still no luck.
 

nathank1989

Contributor
Joined
Aug 29, 2016
Messages
103
Thanks for the answer, i tried removing redis and all its folders, then installed it again and followed the guide again. (quick stupid question, when you say to update redis.conf to run on local socket, you just mean to nano into it and modify the lines you talk about in the guide, right?). Still no luck.

Correct. Use nano. And if you want to reinstall it just pkg remove pkg install. Don't manually delete files unless you know exactly where everything is.

And actually after talking to someone else I found that redis SHOULD be 777 not 750 nor 755 as shown in dozens other guides. Nextcloud will throw dav permission errors, my mistake!
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Here i am again, still stuck on the redis step, i'll attach a few screens of my redis.conf

By the way i tried to make everything from scratch, making sure to follow every single line.


EDIT: I felt dumb many times in my life, but this has to be in the top list. I forgot to remove "#". I'm now able to run REDIS and get to the nextcloud page.

EDIT 2: I'm getting SQLSTATE[HY000] [2002] No such file or directory when tryng to finish up the nextcloud setup
 

Attachments

  • screen1.jpg
    screen1.jpg
    326.6 KB · Views: 593
  • screen2.jpg
    screen2.jpg
    349 KB · Views: 614
  • screen3.jpg
    screen3.jpg
    307.3 KB · Views: 570
Last edited:

nathank1989

Contributor
Joined
Aug 29, 2016
Messages
103
Here i am again, still stuck on the redis step, i'll attach a few screens of my redis.conf

By the way i tried to make everything from scratch, making sure to follow every single line.


EDIT: I felt dumb many times in my life, but this has to be in the top list. I forgot to remove "#". I'm now able to run REDIS and get to the nextcloud page.

EDIT 2: I'm getting SQLSTATE[HY000] [2002] No such file or directory when tryng to finish up the nextcloud setup

Uncomment the unix socket settings as seen in my attachement:

As for the SQLState error, I'm unfamiliar with that error, but I would double check the database.
1. Navigate to /var/db/mysql do you see files there?
2. Run stat on /var/db/mysql to make sure the correct permissions are set, and that mysql:mysql owns the folder and it's contents
3. You're not running nextcloud as the mysql root user
4. Sign into mysql cli as root (or install phpmyadmin) and see if any databases were created
5. If your database is there, make sure that your nextcloud user is set to have ALL PRIVILEGES
6. Check permissions of /tmp/mysql.sock stat -f '%0Lp' /tmp/mysql.sock it should be '777' if not chmod 777 /tmp/mysql.sock
Also make sure it's owned by mysql:mysql or mysql:wheel
6. If all else fails; Google ;)
 

Attachments

  • IMG_1919.PNG
    IMG_1919.PNG
    56.9 KB · Views: 579
Last edited:

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Uncomment the unix socket settings as seen in my attachement:

As for the SQLState error, I'm unfamiliar with that error, but I would double check the database.
1. Navigate to /var/db/mysql do you see files there?
2. Run stat on /var/db/mysql to make sure the correct permissions are set, and that mysql:mysql owns the folder and it's contents
3. You're not running nextcloud as the mysql root user
4. Sign into mysql cli as root (or install phpmyadmin) and see if any databases were created
5. If your database is there, make sure that your nextcloud user is set to have ALL PRIVILEGES
6. Check permissions of /tmp/mysql.sock stat -f '%0Lp' /tmp/mysql.sock it should be '777' if not chmod 777 /tmp/mysql.sock
Also make sure it's owned by mysql:mysql or mysql:wheel
6. If all else fails; Google ;)

I just restarted the jail and apparently everything worked just fine. I got Nextcloud up and running (thank you again). Now i'm having troubles with certbot: when i type
Code:
certbot certonly --webroot -w /usr/local/www/apache24/data/nextcloud -d <<<YOURSITEHERE.COM>>>
i get
Code:
Missing name for redirect
. I understand my knowledge of FreeBSD is very basic to say the least and i apologize in advance if this is frustrating to you. Anyway, any idea?
 

nathank1989

Contributor
Joined
Aug 29, 2016
Messages
103
I just restarted the jail and apparently everything worked just fine. I got Nextcloud up and running (thank you again). Now i'm having troubles with certbot: when i type
Code:
certbot certonly --webroot -w /usr/local/www/apache24/data/nextcloud -d <<<YOURSITEHERE.COM>>>
i get
Code:
Missing name for redirect
. I understand my knowledge of FreeBSD is very basic to say the least and i apologize in advance if this is frustrating to you. Anyway, any idea?

No frustration! This is how a community works, helping each other out. Happy to help.

As for certbot, I'm not sure.
Just a thought, are you typing the angle brackets as well? (Should have been more clear in my guide since I wrote it for myself and copy/pasted to share)

It should look like this
certbot certonly --webroot -w /usr/local/www/apache24/data/nextcloud -d mysite.com
 

marian78

Patron
Joined
Jun 30, 2011
Messages
210
Thx for this perfect tutorial, used for installation on FreeBSD 11. :)
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
No frustration! This is how a community works, helping each other out. Happy to help.

As for certbot, I'm not sure.
Just a thought, are you typing the angle brackets as well? (Should have been more clear in my guide since I wrote it for myself and copy/pasted to share)

It should look like this
certbot certonly --webroot -w /usr/local/www/apache24/data/nextcloud -d mysite.com

Thanks a lot (again), i was able to set up certbot but whn i try to restart apache this is what i'm getting :/
Code:
Performing sanity check on apache24 configuration:
AH00526: Syntax error on line 25 of /usr/local/etc/apache24/Includes/mynoip.ddns.net.conf:
SSLCertificateFile: file '/usr/local/etc/letsencrypt/live/mynoip.ddns.net/fullchain.pem' does not exist or is empty
 
Last edited:

nathank1989

Contributor
Joined
Aug 29, 2016
Messages
103
Thanks a lot (again), i was able to set up certbot but whn i try to restart apache this is what i'm getting :/
Code:
Performing sanity check on apache24 configuration:
AH00526: Syntax error on line 25 of /usr/local/etc/apache24/Includes/mynoip.ddns.net.conf:
SSLCertificateFile: file '/usr/local/etc/letsencrypt/live/mynoip.ddns.net/fullchain.pem' does not exist or is empty
Your certs are in a different location. When you created the certs there should have been an output of where the files were put.
You'll need to put those in your *.conf file for apache where we set up SSL.
 

ZodiacUHD

Patron
Joined
Aug 28, 2015
Messages
226
Your certs are in a different location. When you created the certs there should have been an output of where the files were put.
You'll need to put those in your *.conf file for apache where we set up SSL.

And once again, i don't know how to thank you enough. You've been super-helpful and very kind. Thank you very much!
 

JWTech

Dabbler
Joined
Sep 25, 2015
Messages
25
To clean things up a little, you may want to replace this whole chunk:

nathank1989 said:
Enable SSH
$ cd /etc/ssh
$ vi sshd_config


Use... ...sed -i '' 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config and that will auto-replace the text.
Personally, I despise vi, but this is the quickest method I have found. Know a way better, please let me know.
if you don't know how to use vi, here's a quick step by step. I suggest you check out this cheat sheet

Reason we don't use nano here is because keys like ctrl+x do not work in the shell applet used in FreeNAS GUI. We have to use a real terminal like PuTTY to use a nano properly.


    • Scroll down using the DOWN arrow key until you find #PermitRootLogin no line.
    • With the cursor on the # hit x this will delete the hash now use the RIGHT arrow key to select the space before 'no'
    • Hit i type yes
    • Hit esc
    • Select the n in 'no' and hit x twice to delete 'no' so the line reads PermitRootLogin yes
    • type :wq
    • Hit ENTER
    • The file is now saved
Now enable and start SSH

$ sysrc sshd_enable=yes
$ service sshd start

With just something like this:

Enable Root Login:
$ sed -i '' 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config

Enable and Start SSH:
$ sysrc sshd_enable=yes && service sshd start
 

Fist

Cadet
Joined
Oct 14, 2016
Messages
1
I think it's finally time for me to ask for help.

I've gone through everything and believe I have it all set up properly. When I go to my server address the nextcloud screen comes up with the following message:
"You are accessing the server from an untrusted domain.
Please contact your administrator. If you are an administrator of this instance, configure the "trusted_domains" setting in config/config.php. An example configuration is provided in config/config.sample.php.
Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain. "

The there is a link to (Add "xxx.duckdns.org' as a trusted domain")

Any idea where I may have gone wrong? Thanks in advance.
 

Attachments

  • Capture.PNG
    Capture.PNG
    395.4 KB · Views: 938

nathank1989

Contributor
Joined
Aug 29, 2016
Messages
103
I think it's finally time for me to ask for help.

I've gone through everything and believe I have it all set up properly. When I go to my server address the nextcloud screen comes up with the following message:
"You are accessing the server from an untrusted domain.
Please contact your administrator. If you are an administrator of this instance, configure the "trusted_domains" setting in config/config.php. An example configuration is provided in config/config.sample.php.
Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain. "

The there is a link to (Add "xxx.duckdns.org' as a trusted domain")

Any idea where I may have gone wrong? Thanks in advance.

You need to edit the config file to include your domain.

So navigate to your Nextcloud folder
Then enter the config folder
Edit config.php

Find the "trusted_domains" array and replace what's there with your domain.

Where I have a few domains, you may only need one. Replace 0=> with your domain and save the file.
 

Attachments

  • IMG_2327.PNG
    IMG_2327.PNG
    177 KB · Views: 571

pitt1717

Explorer
Joined
Jan 13, 2013
Messages
66
dumb question... how do you manage your data? my question is I have 2 datasets, dataset 1 is where my jails/plugins live and dataset 2 where my storage is. when I install the nextcloud plugin, all the users, data etc get stored in dataset 1, but I want all that info in dataset 2. is there anyway to accomplish this?
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
dumb question... how do you manage your data? my question is I have 2 datasets, dataset 1 is where my jails/plugins live and dataset 2 where my storage is. when I install the nextcloud plugin, all the users, data etc get stored in dataset 1, but I want all that info in dataset 2. is there anyway to accomplish this?
Turn on the external storage app in nextcloud and mount the dataset to your jail.
 
Status
Not open for further replies.
Top