# Installing ONLYOFFICE on Nextcloud (CasaOS/Ubuntu)

### Overview

This guide covers deploying **ONLYOFFICE Document Server** as a backend engine via CasaOS and integrating it with **Nextcloud**. This setup provides a high-performance office suite capable of handling Microsoft Office formats (`.docx`, `.xlsx`, `.pptx`) directly within the browser.

---

### Prerequisites

- **Nextcloud** running on Ubuntu (via Docker/CasaOS).
- **Reverse Proxy** already configured for your main domain (`nc.goonersnas.com`).
- A dedicated subdomain (e.g., `office.goonersnas.com`) with an SSL certificate.

---

### Step 1: Deploy ONLYOFFICE Document Server (Backend)

We use a separate Docker container for the rendering engine to ensure stability and performance.

1. Open **CasaOS** and click the **+** icon to **install a customized app**.
2. Click **Import** in the top right and paste the following Docker Compose snippet:

```
name: onlyoffice
services:
  onlyoffice:
    image: onlyoffice/documentserver:latest
    container_name: onlyoffice-docs
    environment:
      - JWT_ENABLED=true
      - JWT_SECRET=SecretGoonersKey123
    ports:
      - "8888:80"
    restart: unless-stopped
```

3. **Submit** and **Install**.
4. *Optional:* Change the **Network** setting in CasaOS to match your Nextcloud bridge (e.g., `big-bear-nextcloud-ls`).

---

### Step 2: Reverse Proxy Configuration (Crucial)

To avoid the **Mixed Active Content** error, ONLYOFFICE must be served over HTTPS.

- Point your subdomain (e.g., `office.goonersnas.com`) to your server IP.
- In your Reverse Proxy manager, create a new host: 
    - **Domain:** `office.goonersnas.com`
    - **Forward IP:** `192.168.0.152`
    - **Forward Port:** `8888`
- Enable **SSL** and force SSL.

---

### Step 3: Integration in Nextcloud

1. **Install the App:** Go to **Apps** &gt; **Office &amp; text**. Find **ONLYOFFICE**,** click **Download,** and enable**.
2. **Configure Settings:**
    - Go to **Administration settings** &gt; **ONLYOFFICE**.
    - **Document Editing Service address:** `https://office.goonersnas.com/`
    - **Secret key:** `SecretGoonersKey123`
    - Click **Save**.

---

<div id="bkmrk-important%3A-if-you-se" style="background-color: #fff3cd; border-left: 5px solid #ffeeba; padding: 15px; margin: 20px 0; color: #856404; border-radius: 4px;">**IMPORTANT:** If you see a red error banner stating "Mixed Active Content is not allowed," it means your Nextcloud (`https`) is trying to talk to an insecure ONLYOFFICE address (`http`). **Always** use the secure public subdomain URL in the Nextcloud settings to resolve this.</div>---

### Verification

To verify the installation, navigate to your **Files** app and create a new **Document**. If the editor loads the Word-style interface, the integration is successful.