Jump to content

How to build nextcloud and emby on one Vps


XDDMDS
Go to solution Solved by CassTG,

Recommended Posts

I have a vps ,Debian 10. I want to build both nextcloud and emby on it. Use domain to access them, like nextcloud.xxx.com to access nextcloud, emby.xxx.com to access emby. Is that possible?

What should I do? Appreciate it!

Link to comment
Share on other sites

2 hours ago, XDDMDS said:

I have a vps ,Debian 10. I want to build both nextcloud and emby on it. Use domain to access them, like nextcloud.xxx.com to access nextcloud, emby.xxx.com to access emby. Is that possible?

What should I do? Appreciate it!

Personally i do this via Docker.

I run a root server (dedicated resource VPS) and have loads of services running on it via Docker. Easier to add or remove services as well as backup and restore elsewhere.

Emby runs like a champ on it, whilst i don't run nextcloud on it as thats on my home server i do run the document server on it that nextcloud links to for office like editing.

I know some prefer running direct in OS but i swear by docker even though it can be addictive lol

 

Link to comment
Share on other sites

  • Solution

Ill drop this guide i wrote before so you can see whats involved albeit if you do try and follow it it should only take a half hour or so and i will add the nextcloud bit below

 

Docker Setup inc, Portainer (manager), Swag (proxy) and Emby

 

Do note that the docker images reffered to in that post are old now so you would replace the versions with the following:

Emby - CHANGE

/linuxserver/emby:version-4.6.4.0 TO - /linuxserver/emby:4.6.7

Swag -CHANGE 

/linuxserver/swag:version-1.20.0 TO -  /linuxserver/swag:1.23.0 

 

Now reference Nextcloud, this is the one piece of software i hate setting up, as every new release just breaks, so do not be tempted to go with the very latest v23 as well i tried it and the amount of errors it throws was painful so here is the docker cli i use:

First things first, create your "DATA" folder somewhere else in the server, i.e /home/username/NXTCLD - this places it outside of Nextcloud own data folder and recommended by the NC team as best practice security wise.

 

Also when you setup SWAG as per previous guide  make sure you have added a subdomain for Nextcloud in their, i.e cloud.yourdomain.com so we can access it securely.

 

docker run -d \
  --name=nextcloud \
  --net=My-Network \
  --ip=172.20.0.12 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/London \
  -v nextcloud_data:/config \
  -v /path/to/datafolder:/data \
  --restart unless-stopped \
  linuxserver/nextcloud:version-22.2.3

Points to note

 

--net will be the name of the custom network you created if you followed the previous guide

--ip set a fixed IP address if you want to or remove this line 

PUID and PGID - as per previous guide set this to the user thats created on your OS,rather than root which is never a good idea. If no user other than root has been created then follow a guide and add root, HOWEVER note the following, the folder you create in home must be under the same user, if you created that folder as ROOT, nextcloud wont be able to read or write to it, you can change the owner if you created it as root by just chown it recursively.

-v nextcloud_data:/config is just creating a persistant volume so if you delete docker or upgrade all settings etc remain in tact

-e TZ= Set this to the timezone you are in following the same format as the example

-v /path/to/datafolder - This is the folder you created before and where all your documents will go

 

Now this example picks version 22.2.3 which i can confirm as of today is working great, v 23 as i mentioned failed miserably foir me and this is normally the case with new NC releases, avoid like the plague.

 

You will also need a mariadb docker for nextcloud to work, this is quick and simple

docker run -d \
  --name=mariadb \
  --net=MY-NETWORK \
  --ip=172.20.0.10 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e MYSQL_ROOT_PASSWORD=Enteraverylongpasswordherenosymbols \
  -e TZ=Europe/London \
  -e MYSQL_DATABASE=nextcloudd0ck3rdb \
  -e MYSQL_USER=createausernamehere \
  -e MYSQL_PASSWORD=Enteraverylongpasswordherenosymbols \
  -v mariadb_data:/config \
  -v mariadb_data:/root \
  --restart unless-stopped \
  ghcr.io/linuxserver/mariadb:10.5.13-alpine

 Same comments refer to above match userids etc to the actualy user on your system non root, create 2 long passwords for root db user and actually user, you will enter these on the nextcloud setup page

Now to setup reverse proxy so you can access it.

Access the swag docker terminal ither via Portainer > Swag > Console 

or via your server terminal

docker exec -it swag /bin/bash

navigate to:

cd /config/nginx/proxy-confs

Copy the nextcloud example to working version

cp nextcloud.subdomain.conf.sample nextcloud.subdomain.conf

then edit the file

nano nextcloud.subdomain.conf

for now all you need to do is add the domain you are using into the file so for example if you called the subdomain "cloud" edit the following line to look like this

server_name cloud.*;

If you wanted to activate http2  change the top lines as follows

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

Now close the files by CTRL O and CTRL X to save and close

Now type EXIT to close the terminal session

You need to then reboot swag so via portainer you can just reboot using the button, or if you did the above via an ssh terminal session type

docker restart swag

Now if you visit YOURSUBDOMAIN.DOMAIN.Whatever you should get to the Nextcloud setup screen

When you enter the database details under host you can just type the docker name:3306 i.e mariadb:3306

If all goes well you should have working nextcloud, however a cpl more change to make for security and performance

First PHP and Upload limits

Again enter terminal either via portainer or terminal of the NEXTCLOUD CONTAINER

 

Edit The foillwoing

nano /etc/php.ini

 

To search in nano use CTRL W and enter the search terms below (only enter the bolded text to search not the values)

memory_limit = 512M (depends on how much memory your server has, can decrease or increase)

upload_max_filesize =1024M - this sets upload as default to circa 1GB file max, increase to whatever the max you will upload is

post_max_size = 1024M - I match this to upload max filesize

;date.timezone = - remove the semi colon and set timezone as you did for docker cli i.e Europe/London

 

CTRL O and CTRL X to save and exit again,

Finally time to add Swag as a trusted proxy

nano /config/www/nextcloud/config/config.php

Be careful here we need to add what was explained in the SWAG Nextcloud.conf file:

After the 'secret line' press enter so we have a space, make sure you are on the line where the space is and paste the following making sure it is indented correctly the first line should be in line with the secret line above, add your subdomain etc here changing each line as detailed below

'trusted_proxies' => ['swag'],
  'overwrite.cli.url' => 'https://yoursubdomain.domain.whatever/',
  'overwritehost' => 'yoursubdomain.domain.whatever',
  'overwriteprotocol' => 'https',
  'trusted_domains' =>
  array (
    0 => '192.168.0.1:444', # This line may look different on your setup, don't modify it.
    1 => 'yoursubdomain.domain.whatever',
    2 => 'https://yoursubdomain.domain.whatever',
  ),

CTRL O and CTRL X to save and exit again,

then type exit to exit session (if via ssh and not portainer)

Now reboot the nextcloud docker for the settings to take affect

If all went well ( and unless you had a typo or entered something in wrong place) nextcloud should be good to go.

 

Edited by CassTG
Link to comment
Share on other sites

2 hours ago, CassTG said:

Ill drop this guide i wrote before so you can see whats involved albeit if you do try and follow it it should only take a half hour or so and i will add the nextcloud bit below

 

Docker Setup inc, Portainer (manager), Swag (proxy) and Emby

 

Do note that the docker images reffered to in that post are old now so you would replace the versions with the following:

Emby - CHANGE

/linuxserver/emby:version-4.6.4.0 TO - /linuxserver/emby:4.6.7

Swag -CHANGE 

/linuxserver/swag:version-1.20.0 TO -  /linuxserver/swag:1.23.0 

 

Now reference Nextcloud, this is the one piece of software i hate setting up, as every new release just breaks, so do not be tempted to go with the very latest v23 as well i tried it and the amount of errors it throws was painful so here is the docker cli i use:

First things first, create your "DATA" folder somewhere else in the server, i.e /home/username/NXTCLD - this places it outside of Nextcloud own data folder and recommended by the NC team as best practice security wise.

 

Also when you setup SWAG as per previous guide  make sure you have added a subdomain for Nextcloud in their, i.e cloud.yourdomain.com so we can access it securely.

 

docker run -d \
  --name=nextcloud \
  --net=My-Network \
  --ip=172.20.0.12 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/London \
  -v nextcloud_data:/config \
  -v /path/to/datafolder:/data \
  --restart unless-stopped \
  linuxserver/nextcloud:version-22.2.3

Points to note

 

--net will be the name of the custom network you created if you followed the previous guide

--ip set a fixed IP address if you want to or remove this line 

PUID and PGID - as per previous guide set this to the user thats created on your OS,rather than root which is never a good idea. If no user other than root has been created then follow a guide and add root, HOWEVER note the following, the folder you create in home must be under the same user, if you created that folder as ROOT, nextcloud wont be able to read or write to it, you can change the owner if you created it as root by just chown it recursively.

-v nextcloud_data:/config is just creating a persistant volume so if you delete docker or upgrade all settings etc remain in tact

-e TZ= Set this to the timezone you are in following the same format as the example

-v /path/to/datafolder - This is the folder you created before and where all your documents will go

 

Now this example picks version 22.2.3 which i can confirm as of today is working great, v 23 as i mentioned failed miserably foir me and this is normally the case with new NC releases, avoid like the plague.

 

You will also need a mariadb docker for nextcloud to work, this is quick and simple

docker run -d \
  --name=mariadb \
  --net=MY-NETWORK \
  --ip=172.20.0.10 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e MYSQL_ROOT_PASSWORD=Enteraverylongpasswordherenosymbols \
  -e TZ=Europe/London \
  -e MYSQL_DATABASE=nextcloudd0ck3rdb \
  -e MYSQL_USER=createausernamehere \
  -e MYSQL_PASSWORD=Enteraverylongpasswordherenosymbols \
  -v mariadb_data:/config \
  -v mariadb_data:/root \
  --restart unless-stopped \
  ghcr.io/linuxserver/mariadb:10.5.13-alpine

 Same comments refer to above match userids etc to the actualy user on your system non root, create 2 long passwords for root db user and actually user, you will enter these on the nextcloud setup page

Now to setup reverse proxy so you can access it.

Access the swag docker terminal ither via Portainer > Swag > Console 

or via your server terminal

docker exec -it swag /bin/bash

navigate to:

cd /config/nginx/proxy-confs

Copy the nextcloud example to working version

cp nextcloud.subdomain.conf.sample nextcloud.subdomain.conf

then edit the file

nano nextcloud.subdomain.conf

for now all you need to do is add the domain you are using into the file so for example if you called the subdomain "cloud" edit the following line to look like this

server_name cloud.*;

If you wanted to activate http2  change the top lines as follows

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

Now close the files by CTRL O and CTRL X to save and close

Now type EXIT to close the terminal session

You need to then reboot swag so via portainer you can just reboot using the button, or if you did the above via an ssh terminal session type

docker restart swag

Now if you visit YOURSUBDOMAIN.DOMAIN.Whatever you should get to the Nextcloud setup screen

When you enter the database details under host you can just type the docker name:3306 i.e mariadb:3306

If all goes well you should have working nextcloud, however a cpl more change to make for security and performance

First PHP and Upload limits

Again enter terminal either via portainer or terminal of the NEXTCLOUD CONTAINER

 

Edit The foillwoing

nano /etc/php.ini

 

To search in nano use CTRL W and enter the search terms below (only enter the bolded text to search not the values)

memory_limit = 512M (depends on how much memory your server has, can decrease or increase)

upload_max_filesize =1024M - this sets upload as default to circa 1GB file max, increase to whatever the max you will upload is

post_max_size = 1024M - I match this to upload max filesize

;日期。timezone = - 删除分号并设置时区,就像对 docker cli 即 Europe/London 所做的那样

 

CTRL O 和 CTRL X 再次保存并退出,

终于到了将 Swag 添加为可信代理的时候了

注意这里我们需要添加 SWAG Nextcloud.conf 文件中解释的内容:

在'secret line'按回车后,我们有一个空格,确保你在空格所在的行并粘贴以下确保它正确缩进第一行应该与上面的secret line一致,添加你的子域等在此处更改每一行,如下所述

CTRL O 和 CTRL X 再次保存并退出,

然后输入 exit 退出会话(如果通过 ssh 而不是 portainer)

现在重新启动 nextcloud docker 以使设置生效

如果一切顺利(除非你有错字或输入错误的地方)nextcloud 应该很好。

 

Thanks a lot ! I haven't used docker before. I'll try it!

Link to comment
Share on other sites

  • 3 weeks later...
XDDMDS
On 2/14/2022 at 7:29 PM, CassTG said:

Ill drop this guide i wrote before so you can see whats involved albeit if you do try and follow it it should only take a half hour or so and i will add the nextcloud bit below

 

Docker Setup inc, Portainer (manager), Swag (proxy) and Emby

 

Do note that the docker images reffered to in that post are old now so you would replace the versions with the following:

Emby - CHANGE

/linuxserver/emby:version-4.6.4.0 TO - /linuxserver/emby:4.6.7

Swag -CHANGE 

/linuxserver/swag:version-1.20.0 TO -  /linuxserver/swag:1.23.0 

 

Now reference Nextcloud, this is the one piece of software i hate setting up, as every new release just breaks, so do not be tempted to go with the very latest v23 as well i tried it and the amount of errors it throws was painful so here is the docker cli i use:

First things first, create your "DATA" folder somewhere else in the server, i.e /home/username/NXTCLD - this places it outside of Nextcloud own data folder and recommended by the NC team as best practice security wise.

 

Also when you setup SWAG as per previous guide  make sure you have added a subdomain for Nextcloud in their, i.e cloud.yourdomain.com so we can access it securely.

 

docker run -d \
  --name=nextcloud \
  --net=My-Network \
  --ip=172.20.0.12 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/London \
  -v nextcloud_data:/config \
  -v /path/to/datafolder:/data \
  --restart unless-stopped \
  linuxserver/nextcloud:version-22.2.3

Points to note

 

--net will be the name of the custom network you created if you followed the previous guide

--ip set a fixed IP address if you want to or remove this line 

PUID and PGID - as per previous guide set this to the user thats created on your OS,rather than root which is never a good idea. If no user other than root has been created then follow a guide and add root, HOWEVER note the following, the folder you create in home must be under the same user, if you created that folder as ROOT, nextcloud wont be able to read or write to it, you can change the owner if you created it as root by just chown it recursively.

-v nextcloud_data:/config is just creating a persistant volume so if you delete docker or upgrade all settings etc remain in tact

-e TZ= Set this to the timezone you are in following the same format as the example

-v /path/to/datafolder - This is the folder you created before and where all your documents will go

 

Now this example picks version 22.2.3 which i can confirm as of today is working great, v 23 as i mentioned failed miserably foir me and this is normally the case with new NC releases, avoid like the plague.

 

You will also need a mariadb docker for nextcloud to work, this is quick and simple

docker run -d \
  --name=mariadb \
  --net=MY-NETWORK \
  --ip=172.20.0.10 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e MYSQL_ROOT_PASSWORD=Enteraverylongpasswordherenosymbols \
  -e TZ=Europe/London \
  -e MYSQL_DATABASE=nextcloudd0ck3rdb \
  -e MYSQL_USER=createausernamehere \
  -e MYSQL_PASSWORD=Enteraverylongpasswordherenosymbols \
  -v mariadb_data:/config \
  -v mariadb_data:/root \
  --restart unless-stopped \
  ghcr.io/linuxserver/mariadb:10.5.13-alpine

 Same comments refer to above match userids etc to the actualy user on your system non root, create 2 long passwords for root db user and actually user, you will enter these on the nextcloud setup page

Now to setup reverse proxy so you can access it.

Access the swag docker terminal ither via Portainer > Swag > Console 

or via your server terminal

docker exec -it swag /bin/bash

navigate to:

cd /config/nginx/proxy-confs

Copy the nextcloud example to working version

cp nextcloud.subdomain.conf.sample nextcloud.subdomain.conf

then edit the file

nano nextcloud.subdomain.conf

for now all you need to do is add the domain you are using into the file so for example if you called the subdomain "cloud" edit the following line to look like this

server_name cloud.*;

If you wanted to activate http2  change the top lines as follows

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

Now close the files by CTRL O and CTRL X to save and close

Now type EXIT to close the terminal session

You need to then reboot swag so via portainer you can just reboot using the button, or if you did the above via an ssh terminal session type

docker restart swag

Now if you visit YOURSUBDOMAIN.DOMAIN.Whatever you should get to the Nextcloud setup screen

When you enter the database details under host you can just type the docker name:3306 i.e mariadb:3306

If all goes well you should have working nextcloud, however a cpl more change to make for security and performance

First PHP and Upload limits

Again enter terminal either via portainer or terminal of the NEXTCLOUD CONTAINER

 

Edit The foillwoing

nano /etc/php.ini

 

To search in nano use CTRL W and enter the search terms below (only enter the bolded text to search not the values)

memory_limit = 512M (depends on how much memory your server has, can decrease or increase)

upload_max_filesize =1024M - this sets upload as default to circa 1GB file max, increase to whatever the max you will upload is

post_max_size = 1024M - I match this to upload max filesize

;date.timezone = - remove the semi colon and set timezone as you did for docker cli i.e Europe/London

 

CTRL O and CTRL X to save and exit again,

Finally time to add Swag as a trusted proxy

nano /config/www/nextcloud/config/config.php

Be careful here we need to add what was explained in the SWAG Nextcloud.conf file:

After the 'secret line' press enter so we have a space, make sure you are on the line where the space is and paste the following making sure it is indented correctly the first line should be in line with the secret line above, add your subdomain etc here changing each line as detailed below

'trusted_proxies' => ['swag'],
  'overwrite.cli.url' => 'https://yoursubdomain.domain.whatever/',
  'overwritehost' => 'yoursubdomain.domain.whatever',
  'overwriteprotocol' => 'https',
  'trusted_domains' =>
  array (
    0 => '192.168.0.1:444', # This line may look different on your setup, don't modify it.
    1 => 'yoursubdomain.domain.whatever',
    2 => 'https://yoursubdomain.domain.whatever',
  ),

CTRL O and CTRL X to save and exit again,

then type exit to exit session (if via ssh and not portainer)

Now reboot the nextcloud docker for the settings to take affect

If all went well ( and unless you had a typo or entered something in wrong place) nextcloud should be good to go.

 

I tried this, portainer, emby, swag are all working great. They can all access with my subdomian.

But the nextcloud is not working. I did it step by step, and gone to  

docker restart swag

Then I visit nextcloud.mydomian.com ,the nextcloud page just cannot come out. What shoud I do ? Is there anything missing ? 

 

page.PNG

Link to comment
Share on other sites

CassTG

Hi

 

Points to check

  • Check the nextcloud Swag Proxy-conf, dbl check domain name is nextcloud.yourdomain.com
  • Obvious one but check your dns record for nextcloud.yourdomain.com routes to your IP
  • Did you use the version i mentioned above and not v23

When you open portainer and click on the log file icon next to nextcloud what does it say, what is it's output, this normally gives a good indication of any issues

 

Edited by CassTG
Link to comment
Share on other sites

CassTG

I just fired up a quick test using the same commands above and applying a unused sub domain, as you can see the setup page is immediately shown

You should get this screen before the 2nd half of my NC Guide i.e before adding in the extra entries into the PHP file, this was literally taken after nextcloud cli deploy and after adding the nc proxy conf file and reboot of swag

I would definitely go back and check your swag config file, you can pm me your docker CLI instructions for next cloud if you want me to dbl check that.

Screen Shot 2022-03-07 at 15.42.48.png

Edited by CassTG
Link to comment
Share on other sites

CassTG

Also just thinking out loud, Try your domain again but make sure you type https:// as well as your domain

I just re-read the old guide which is correct but i did not put in the bit to forward http to https in Swag setup, so it does not auto forward

 

Edited by CassTG
Link to comment
Share on other sites

XDDMDS
14 hours ago, CassTG said:

Also just thinking out loud, Try your domain again but make sure you type https:// as well as your domain

I just re-read the old guide which is correct but i did not put in the bit to forward http to https in Swag setup, so it does not auto forward

 

I have figured it out, there's something wrong with my domian. Your guide is completely right. Thank you for your help.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...