# Setting up a Reverse Proxy using NGINX

div
strong
⚠️ Warning:
 This guide provides a general overview of the configuration process. Technical requirements vary by environment; always consult your internal IT or security teams before applying these settings. If you would like to complete this setup with a Foleon technical expert, please contact 
strong
Foleon Support
 or your 
strong
Customer Success Manager.
## 1. Adding your domain into Foleon

- login to Foleon
- go to "Domains" in the Admin Console (or your workspace)
- Use HTTPS protocol to ensure End to End encryption
- Click "Create new Domain"
- Fill in the domain
- Click the checkbox for reverse proxy
- (optional) enter your certificate details
- Click "save"


domains.gif
## 2. Configure the Nginx Location Block

To route traffic, you will add a location block to your Nginx site configuration file (typically located in `/etc/nginx/sites-available/`).

#### The Code Block

Paste the following configuration inside your existing `server { ... }` block. Ensure it is placed before any generic "catch-all" locations.


```nginx
# Define the subfolder path you want to use
location /en/guides/ {
    # Set the Foleon target destination
    # EU: https://s1.foleon.com
    # US: https://s1.us.foleon.com
    set $foleon_target "https://s1.foleon.com";

    # Proxy Headers
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    
    # Connection Settings
    proxy_pass $foleon_target;
    proxy_ssl_server_name on;
    proxy_ssl_protocols TLSv1.2 TLSv1.3;
    proxy_redirect off;

    # Performance Buffers (Ensures large publications load smoothly)
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
}
```

## 3. Variable Reference

You can customize the proxy behavior by adjusting these specific values within the configuration:

| Variable / Directive | Example Value | Description |
|  --- | --- | --- |
| location | `/en/guides/` | The subfolder path on your domain where the content will appear. When applying your domain to your project, ensure the basepath also starts with /en/guides/. |
| $foleon_target | `https://s1.foleon.com` | Use `s1.foleon.com` for EU accounts and `s1.us.foleon.com` for US accounts. |
| X-Forwarded-Host | `$host` | Passes your actual domain name to Foleon so it knows which content to serve. |


## 4. Deploy and Test

1. **Test the configuration:** Run the following command in your terminal to ensure there are no syntax errors: `sudo nginx -t`
2. **Reload Nginx:** If the test is successful, apply the changes: `sudo systemctl reload nginx`
3. **Verify:** Navigate to `https://yourcompany.com/en/guides/` (or your chosen path). A Foleon 404 should now show. Once you finished step 5 your Foleon content should now load invisibly under your domain.


div
strong
SSL requirement:
 Foleon requires HTTPS. Ensure your Nginx server has a valid SSL certificate (e.g., via Let's Encrypt) active for the host domain.

## 5. Apply a domain to a project

1. Login to foleon.
2. Go to project settings.
3. Select the newly created domain.
4. Setup the basepath / subfolder you want to use to publish your documents on.
5. Make sure to publish a document in this project.


div
strong
TIP:
 You can setup multiple projects with the same basepath e.g. 
code
/en/guide/finance/
 and 
code
/en/guide/legal/