> ## Documentation Index
> Fetch the complete documentation index at: https://docs.areawp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install AreaWP on your Linux server with a single command.

<Info>
  This page applies to the **self-hosted** version of AreaWP only. If you are on the **hosted** plan, the server is fully managed by the AreaWP team — your panel is ready to use without any installation steps.
</Info>

## One-Line Installer

Run this on your Linux server (Ubuntu 20.04+, Debian 11+, or Fedora 35+) as root:

```bash theme={null}
curl -fsSL https://areawp.com/install.sh | sudo bash
```

The installer:

1. Detects your OS and installs system dependencies
2. Sets up Python 3.11+, Node.js 20, PostgreSQL, Nginx, Docker
3. Downloads and configures the AreaWP panel
4. Builds the frontend and starts all services
5. Displays the panel URL and default admin credentials

<Info>
  Installation typically takes **3–8 minutes** depending on server speed and network connection.
</Info>

***

## What Gets Installed

<AccordionGroup>
  <Accordion title="Backend Service" icon="gear">
    Flask API running as a **systemd service** (`areawp`) via Gunicorn with GeventWebSocket workers, listening on `0.0.0.0:5000`.

    ```bash theme={null}
    systemctl status areawp
    systemctl restart areawp
    journalctl -u areawp -f
    ```
  </Accordion>

  <Accordion title="Frontend (Docker)" icon="box">
    React frontend served by an **Nginx Docker container** on port 3847, proxied by host Nginx on port 80/443.

    ```bash theme={null}
    docker compose --project-directory /opt/areawp ps
    docker compose --project-directory /opt/areawp logs -f frontend
    ```
  </Accordion>

  <Accordion title="Database (PostgreSQL)" icon="database">
    PostgreSQL installed on the host with a dedicated `areawp` database and user. Connection string stored in `/opt/areawp/.env`.
  </Accordion>

  <Accordion title="Web Server (Nginx)" icon="globe">
    Nginx configured as reverse proxy, handling SSL termination and routing. Config at `/etc/nginx/sites-available/areawp.conf`.
  </Accordion>
</AccordionGroup>

***

## File Locations

| Path                                     | Contents                          |
| ---------------------------------------- | --------------------------------- |
| `/opt/areawp/`                           | Main installation directory       |
| `/opt/areawp/.env`                       | Environment variables and secrets |
| `/opt/areawp/backend/`                   | Flask application                 |
| `/opt/areawp/frontend/dist/`             | Built React assets                |
| `/opt/areawp/venv/`                      | Python virtual environment        |
| `/etc/systemd/system/areawp.service`     | Systemd unit file                 |
| `/etc/nginx/sites-available/areawp.conf` | Nginx configuration               |

***

## Setup Wizard

After installation, open the panel at `http://your-server-ip`. The setup wizard guides you through:

<Steps>
  <Step title="License Key">
    Enter your license key from [account.areawp.com](https://account.areawp.com). Validated against your domain.
  </Step>

  <Step title="Admin Account">
    Create the first admin user — email and password.
  </Step>

  <Step title="Domain">
    Set the primary domain for the panel. Nginx updates automatically.
  </Step>

  <Step title="SSL">
    Provision a free Let's Encrypt certificate for HTTPS access.
  </Step>
</Steps>

***

## Updating

Run the following command **as root on the server** via SSH to check if a new version is available:

```bash theme={null}
areawp update
```

If an update is available, the command displays the new version and prompts for confirmation before proceeding. No data is lost during updates.

You can also see whether an update is available from **Settings → Licensing** inside the panel — however, the actual update must always be run via SSH as root using the command above.

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="502 Bad Gateway">
    Backend not reachable. Verify it's listening on all interfaces:

    ```bash theme={null}
    ss -tlnp | grep 5000
    # Should show: 0.0.0.0:5000
    ```

    If it shows `127.0.0.1:5000`:

    ```bash theme={null}
    sed -i 's/127.0.0.1:5000/0.0.0.0:5000/' /etc/systemd/system/areawp.service
    systemctl daemon-reload && systemctl restart areawp
    ```
  </Accordion>

  <Accordion title="Frontend container unhealthy">
    ```bash theme={null}
    docker logs areawp-frontend --tail=30
    curl http://127.0.0.1:5000/api/v1/system/health
    ```
  </Accordion>

  <Accordion title="Database connection error">
    ```bash theme={null}
    systemctl status postgresql
    grep DATABASE_URL /opt/areawp/.env
    ```
  </Accordion>

  <Accordion title="SSL provisioning failed">
    Ensure port 80 is open and the domain resolves to your server IP. Retry from **Settings → Site Settings → SSL**.
  </Accordion>
</AccordionGroup>
