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

# Nginx

> Nginx is a web server that can be used as a reverse proxy.

## Overview

This guide explains how to deploy Kaneo using Nginx as a reverse proxy. This setup is ideal for production environments where you want to expose Kaneo through a domain name with HTTPS.

## Prerequisites

* A domain name
* A SSL certificate
* A Nginx web server

## Installation

The first step is to make sure nginx is installed and running.

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
sudo apt update
sudo apt install nginx
```

## Configuration

The next step is to configure Nginx to proxy requests to the Kaneo services. We will create two servers, one for the web application and one for the API.

1. Create a new file in the `/etc/nginx/sites-available/kaneo.conf` directory.

```nginx title="kaneo.conf" theme={"theme":{"light":"min-light","dark":"min-dark"}}
server {
  listen 80;
  server_name kaneo.your-domain.com;
 
  location / {
    proxy_pass http://localhost:5173;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}
 
server {
  listen 80;
  server_name kaneo-api.your-domain.com;
 
  location / {
    proxy_pass http://localhost:1337;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}
```

2. Enable the configuration by creating a symlink to the `sites-enabled` directory.

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
sudo ln -s /etc/nginx/sites-available/kaneo.conf /etc/nginx/sites-enabled/
```

3. Test the configuration.

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
sudo nginx -t
```

4. Restart Nginx to apply the changes.

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
sudo systemctl restart nginx
```

## Key points

* This configuration is for a single server, if you want to use a load balancer, you need to configure it accordingly.
* This configuration is for a single domain, if you want to use a subdomain, you need to configure it accordingly.
