<commit_before># Self Hosting

Some users might want to host their own Threema Web instance. Here is a quick
overview on how to achieve that.

The following components can be self-hosted:

- Threema Web
- SaltyRTC Server
- STUN / TURN Server

The push relay server could in theory be self-hosted too, but it won't help as
the GCM / APNs API keys required to dispatch push notifications are not public.

If you have questions, please [open an
issue](https://github.com/threema-ch/threema-web/issues) on Github.

## Threema Web

Threema Web is a web application written in TypeScript with AngularJS 1. All
that is required to host it is a web server that can deliver static content via
https. We recommend using Nginx. Additionally, to build the
release version yourself, a recent version of npm is required.

*Note:* The web server needs to set the proper MIME type for `*.wasm`
(WebAssembly) files. When using Nginx, add the following line to the types in
`/etc/nginx/mime.types`:

    application/wasm    wasm;

When using Python,
[someting like this](https://gist.github.com/dbrgn/6bf88d32b1b44b1b1d4140f92b8a7a0a)
should work.

### Building from source

You can get the source code from Github:

    git clone https://github.com/threema-ch/threema-web.git

First, adjust the configuration in `src/config.ts`:<commit_msg>Docs: Wasm header: Add instructions for Apache (#908)<commit_after># Self Hosting

Some users might want to host their own Threema Web instance. Here is a quick
overview on how to achieve that.

The following components can be self-hosted:

- Threema Web
- SaltyRTC Server
- STUN / TURN Server

The push relay server could in theory be self-hosted too, but it won't help as
the GCM / APNs API keys required to dispatch push notifications are not public.

If you have questions, please [open an
issue](https://github.com/threema-ch/threema-web/issues) on Github.

## Threema Web

Threema Web is a web application written in TypeScript with AngularJS 1. All
that is required to host it is a web server that can deliver static content via
https. We recommend using Nginx. Additionally, to build the
release version yourself, a recent version of npm is required.

*Note:* The web server needs to set the proper MIME type for `*.wasm`
(WebAssembly) files. When using Nginx, add the following line to the types in
`/etc/nginx/mime.types`:

    application/wasm    wasm;

If you're using Apache, add the following line to
`/etc/apache2/mods-enabled/mime.conf`:

    AddType application/wasm .wasm

When using Python,
[something like this](https://gist.github.com/dbrgn/6bf88d32b1b44b1b1d4140f92b8a7a0a)
should work.

### Building from source

You can get the source code from Github:

    git clone https://github.com/threema-ch/threema-web.git

First, adjust the configuration in `src/config.ts`:
{'fraction_non_alphanumeric': 0.07180945609669392, 'fraction_numerical': 0.015641663704230358, 'mean_word_length': 4.07027027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3907477', 'n_tokens_mistral': 898, 'n_tokens_neox': 849, 'n_words': 383}