Skip to content

Commit

Permalink
Added info to nginx doc (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
AtibQur authored Oct 28, 2024
1 parent dd96a5c commit d8dd7f4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions sites/cheerpx/src/content/docs/11-guides/nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ title: Basic server setup
description: Serve your own project using nginx
---

CheerpX requires [SharedArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), which itself requires the site to be cross-origin isolated. This means that the server must set the appropriate headers.
## Overview

Here's an example of a basic nginx configuration that allows CheerpX to run.
This guide will help you set up a basic server using nginx to run your project with CheerpX. CheerpX requires [SharedArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), which itself requires the site to be cross-origin isolated. This means that the server must set the appropriate headers.

## Configuration Steps

### 1. Prepare Your Nginx Configuration

Create a file named `nginx.conf` and add the following configuration:

```nginx
worker_processes 1;
Expand Down Expand Up @@ -43,9 +49,16 @@ http {
}
```

This configuration will work over localhost in a development environment. When the application is deployed, it must be served over HTTPS.
This is a basic nginx configuration that allows CheerpX to run.

### 2. Important notes

- This setup is suitable for a **development environment** on `localhost`, which is an exception to the usual cross-origin isolation requirements.
- For **production environments**, it is important to use **HTTPS** to ensure cross-origin isolation and overall securitity, since cross-origin isolation cannot be achieved without **HTTPS** (with the exception of localhost).

### 3. Run Nginx

Then run nginx using this configuration with the following command line.
Use the following command to start nginx with your configuration:

```bash
nginx -c nginx.conf -p .
Expand Down

0 comments on commit d8dd7f4

Please sign in to comment.