Installing Nextcloud + nginx + letsencrypt

Hello,

I’m trying to install Nextcloud with nginx but I can’t find a good guide on how to do it. This guide was really good but it is using apache and I got stuck.

I already have a jail in TrueNAS with nginx installed which is handling Emby as my media server but can’t install Nextcloud. The steps that I have done are:

  • Create a Nextcloud jail
  • Install nginx
  • Install php
  • Install MariaDB

but then I get stuck because the majority of guides are for apache. Could someone be so kind to help me (guide me) with the installation please? The guide above I posted seems really good because it is separating the Nextcloud config, db, and themes from the actual data which is good but at the same time is a bit confusing for me since I’m not that good at setting up proxy stuff or networking.

Please, if you have the time to help me out, I could really really use a hand :slight_smile:

Hi,

Maybe this doc can help you?

I like this installation guides. You can combine them. In the second link you find something about nginx.

Debian with apache2
Ubuntu with nginx

How do I know when to place Nextcloud in the webroot of nginx or in a subdir webroot of nginx?

What is your nextcloud URL? Something like “https://cloud.example.org” (webroot)? Or “https://example.org/nextcloud” (subdir)?

did you had a look at How to set up an nginx reverse proxy with SSL termination in FreeNAS to put a reverse proxy in front of emby and nextcloud first?

(is freenas == truenas?)

Right now neither but I would like it to be the second one.

I did read that guide before but is difficult to understand for me. I can post my proxy settings if that helps? Also, FreeNAS y now TrueNAS.

This is my nginx config so far (the config works for Emby as of right now):
image

Since I want to use my domain, do I include the nginx config (the one you guys provided from Nextcloud website) right below the Emby config? I’m talking about this file:

If I do include that file, I get this error:
image

I also noticed that my config.php is missing and I don’t know why, I used ‘pkg install php80’ with all the necessary packages… any ideas why?

I unzipped the file again using the -v flag and found out that config.php is not installed by default:
image
What should I do? I downloaded 3 different files from here and none of those installed the config.php file when I unzipped the files! These are the versions I downloaded:
image

Help me please :frowning:

why do you want to use nginx as the “nextcloud web-server”? you can go with apache as well.

this is a reverse proxy config: → proxy_pass http:// line.

it’s - more or less - the same like in article How to set up an nginx reverse proxy with SSL termination in FreeNAS he is using include statements for the ssl_ and proxy_ lines. if you check the article you’ll get the point.

grafik

so yes. in principal you have to create a second vhost server{} in your nginx config pointing to the nextcloud apache webserver.

don’t get confused: your nginx is the reverse proxy. i think you can’t use this nginx as the nextcloud web-server because it is running in a different jail. or?

ok?

I finally managed to install NC. The issue now is that when I try to use mydomain.com/nextcloud/ I get a 404 not found error. I have added to the trusted domains in config.php the new IP and my domain. On the nginx config file I have also added the IP and domain.

What could be the issue?

Hi. This guide is german, but it’s really good and I have already installed two servers using the following installation guide:

Bye, Sven

The part where I am stuck is configuring nginx.conf because I have a separate jail (nginx) that handles internet traffic and certificates renewals. This is what I have so far:
Jail 1: nginx reversed proxy installed with the fullchain.pem and privkey.pem
Jail 2: Emby which is using mydomain.com just fine
Jail 3: Nextcloud installed (mariaDB installed and configured, nginx installed, php installed, redis installed, php-fpm installed - the part that I don’t know how to configure is nginx.conf (from jail 1)

Can anyone guide me?