# Configuration

Configuration file for [Tempesta FW](https://github.com/tempesta-tech/tempesta) is a simple text file. The file location is passed to [Tempesta FW](https://github.com/tempesta-tech/tempesta) kernel module as parameter and can’t be changed until the module is unloaded. See [Run & stop](/content/knowledge-base/Configuration/Run-and-stop/index.html) for complete instructions.

The configuration file is C-program-like: you must define something before using it. E.g. a server group must be defined before it’s first use in load balancing rules:

|     |     |
| --- | --- |
| `1` | `srv_group static {` |
| `2` | ```server 10.10.0.1;` |
| `3` | `}` |
| `4` | `sched_http_rules {` |
| `5` | ```match static uri prefix``"/static/"``;` |
| `6` | `}` |

Configuration directives are described on [Tempesta FW Wiki pages](https://github.com/tempesta-tech/tempesta/wiki) and the brief description is provided as [a sample configration file](https://github.com/tempesta-tech/tempesta/blob/master/etc/tempesta_fw.conf).

## Quick start

### Install Tempesta FW

Install Tempesta FW [from sources](/content/knowledge-base/Configuration/Install-from-Sources/index.html) or [binary packages](/content/knowledge-base/Configuration/Install-from-packages/index.html). Don’t forget to check the [system requirements](/content/knowledge-base/Configuration/Requirements/index.html).

### Configure

You can use this configuration file to quickly start Tempesta FW in a configuration like we’ve showed in the [FOSDEM talk](https://fosdem.org/2021/schedule/event/webperf_fast_tls/):

|     |     |
| --- | --- |
| `01` | `# cat etc/tempesta_fw.conf` |
| `02` | `listen 192.168.100.4:443 proto=https;` |
| `03` | `listen 192.168.100.4:80;` |
| `04` |  |
| `05` | `# Example include usage` |
| `06` | `# !include /etc/tempesta/sites/*` |
| `07` |  |
| `08` | `srv_group default {` |
| `09` | ```server 127.0.0.1:8080 conns_n=4;` |
| `10` | `}` |
| `11` |  |
| `12` | `vhost my_hostname {` |
| `13` | ```tls_certificate /root/tempesta/etc/tfw-root.crt;` |
| `14` | ```tls_certificate_key /root/tempesta/etc/tfw-root.key;` |
| `15` |  |
| `16` | ```proxy_pass default;` |
| `17` | `}` |
| `18` |  |
| `19` | `cache 1;` |
| `20` | `cache_fulfill * *;` |
| `21` |  |
| `22` | `block_action attack reply;` |
| `23` |  |
| `24` | `http_chain {` |
| `25` | ```-> my_hostname;` |
| `26` | `}` |

`192.168.100.4` is the listening IP address for Tempesta FW. Read more about this configuration option in the [Handling clients](/content/knowledge-base/Configuration/Handling-clients/index.html) chapter.

This address must be resolved from `my_hostname` host name. The host name is important for TLS SNI, so use the real name of you machine. You can find the details how to configure Tempesta TLS in the [TLS](/content/knowledge-base/Configuration/Tempesta-TLS/index.html) chapter. Note that you need to place your certificate and the private key into the Tempesta FW configuration directory. In this case Tempesta FW was [built from sources](/content/knowledge-base/Configuration/Install-from-Sources/index.html), so the configuration directory is located right in the `tempesta/etc` directory. You can generate [self-signed certificates with OpenSSL](/content/knowledge-base/Configuration/HTTPS-performance#tls-certificates/index.html).

`127.0.0.1:8080` is the address of the backend (upstream) server. Tempesta FW is a pure HTTPS accelerator, so it requires some HTTP server to get content from. Read more about backend configuration in the [Servers](/content/knowledge-base/Configuration/Backend-servers/index.html) chapter.

The cache options `cache` and `cache_fulfill` specify that all the content will be cached by Tempesta FW. You can find the details how to configure the options in the [Caching](/content/knowledge-base/Configuration/Caching-Responses/index.html) chapter.

### The `!include` Directive

|     |     |
| --- | --- |
| `1` | `!include /etc/tempesta/sites/*` |

The include directive allows you to create separate configuration files, making large configurations easier to read and manage. It’s especially useful for organizing TF blocking hashes, server groups, or other dynamic configuration elements that may need to be updated on-the-fly.

The directive recursively replaces the line containing it with the contents of the specified files, exactly as they are. It does not follow the context of the configuration or validate variables — it simply reads the files as plain text.

> Note
>
> The directive accepts a directory containing configuration files to include. It expects files with a `.conf` extension.
>
> Warning
>
> A semicolon at the end of the include line is not required, and the path must point to a directory, not a single file.

### Run!

In most of the cases you just need to

|     |     |
| --- | --- |
| `1` | `tempesta.sh --start` |

Check [Run & Stop](/content/knowledge-base/Configuration/Run-and-stop/index.html) page for more instructions about the Linux settings and relative path of the startup script.
