Installing NextCloud onto Onlyoffice Document Server

Hey,

Ive installed and configured my OnlyOffice Document Server to work on Https on a Centos 7 godaddy VPS and it works beautifully. However i would like the Nextcloud integration to make my life easier. Ive done hours of researching how to get this done but it seems as if there is ambiguous solutions to do this and ive tried a few with no avail.

Onlyoffice comes with Nginx web server. I have already tried installing NextCloud with nginx support. Now when i navigate to my website https://website.com, it didnt load the nextcloud page but instead kept loading my website with the Onlyoffice document server running. My assumption is that the nginx conf file for onlyoffice document server was pointing the port 443 to my onlyoffice website and not nextcloud. So i tried making adjustments but nothing seem to work.

Is there any tutorial or path i can take to having nextcloud installed and integrated with my document server/website 
 given that the Onlyoffice document server is already installed on the server?

Im trying to have a website that allows me to have nextcloud and onlyoffice functionality with a front end of my design.

Any help is kindly appreciated as i need to get this done immediately.

Hi @Benji_Weiss

I have Nextcloud and Onlyoffice (docker) working together on my current server and had a non-docker version together with NC running on my old server, so I can probably help.
Without docker I found this guide very helpful:

Do you already have two different sub-domains for Nextcloud and Onlyoffice? This would be helpful. I guess there is more than one way, but I found it very helpful having two sub-domains, for example:

In any way (docker or not docker) the idea would be to forward requests for the specific sub-domain to the right handler for that. As example for docker version:

server {
    listen 443 ssl http2;
    server_name cloud.domain.com
    root /path/to/nextcloud/;
    ...
    [normal nextcloud nginx-config]
}

upstream onlyoffice-docker {
server localhost:8443;
}

server {
    listen 443 ssl http2;
    server_name office.domain.com
    ...
    location / {
        proxy_pass         https://onlyoffice-docker;
        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;

    }

}

Depending on your setup you could check if Redis needs some reconfiguration regarding socket/ port. Just mentioning that beforehand if either NC or OO stops working, Redis config could be something to have a look at then.
I hope this helps so far. Otherwise your (web server) configs and a description of your setup (one nginx for OO and one nginx for NC or do you use apache for NC?) would be helpful.

Hey, thanks for the pointer, however i have already followed that tutorial and had many issues running NextCloud and Onlyoffice both using Nginx as my webserver.

I dont own a domain name so im using a no-ip ddns hostname. This means i dont have access to subdomains.
Now i have attempted to use NC with nginx but it was not working accordingly. Not sure why but i figured maybe i should use apache instead. I currently have httpd and nginx services running at the same time, no conflicts.

Now when i navigate to my website, it automatically directs me to the index.html page located in my welcome directory within my onlyoffice directory on my server. This is exactly what i would want. But i want to add a Login tab to the page, so when the user clicks the login tab, it redirects them to the nextcloud server
prompting them to login in to Nextcloud and giving them access only to the documents they have permissions to (read only or read/write).

The only way i have apache running is that it is listening on different ports than nginx. Since both are using https, nginx is listening on port 443, and apache is listening on 8443. However, when i enter website.com:8443, i get an error in my browser like so “NET::ERR_CERT_AUTHORITY_INVALID” .

I dont know why i would get an error like that as ive tested my ssl certificate successfully.

The important information in my ssl.conf file for apache (httpd) looks like so:

Listen 8443 https


< VirtualHost _ default _:8443>
DocumentRoot "/var/www/nextcloud"
ServerName website:8443

<Directory “/var/www/cgi-bin”>
SSLOptions +StdEnvVars
< /Directory> (the spaces in the tags are there so this reply could show you the html tags from my conf file)

and heres my nginx onlyoffice conf file:

include /etc/nginx/includes/onlyoffice-http.conf;

server {
listen 0.0.0.0:80;
server_tokens off;
root /nowhere; ## root doesn’t have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
#HTTP host for internal services
server {
listen 127.0.0.1:80;
#listen [::1]:80;
server_name localhost;
server_tokens off;
include /etc/nginx/includes/onlyoffice-documentserver-common.conf;
include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf;
}
#https host
server {
listen 0.0.0.0:443 ssl;
#listen [::]:443 ssl default_server;
server_name website;
server_tokens off;
root /var/www/onlyoffice/;

ssl_certificate {path to certificate .pem}
ssl_certificate_key {path to private certificate key}

ssl_protocols TLSv1.2;
ssl_ciphers ‘ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256’;
ssl_prefer_server_ciphers on;

add_header Strict-Transport-Security max-age=15768000;

ssl_session_cache builtin:1000 shared:SSL:10m;
add_header X-Content-Type-Options nosniff;

location ~ /.well-known/acme-challenge {
root /var/www/onlyoffice/;
allow all;
}

location ~ .php$ {

    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass https://website.com:8443;

}

include /etc/nginx/includes/onlyoffice-documentserver-*.conf;
}

Im not sure what changes i need to make. Nextcloud is located in the /var/www/nextcloud directory. Your help is extremely appreciated.

(PS, the conf file says website, but its really the URL for my domain as i cant post more than 2 urls in this forum so please keep in mind that the syntax does contain .com after it)