# Self-host OpenResty

> The OpenResty web platform, Nginx with LuaJIT, on the Alpine image with a persistent web root. It serves the default page until you add content or configuration.

- Page: https://levelrail.com/templates/openresty/
- JSON: https://levelrail.com/templates/openresty.json
- Category: Infrastructure
- Licence: BSD-2-Clause (Permissive license)
- Source: https://github.com/openresty/openresty
- Upstream docs: https://openresty.org/en/

## Requirements
- Memory: about 128 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: 1.27.1.2-13-alpine-fat

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| openresty | openresty/openresty | 1.27.1.2-13-alpine-fat | 80 | openresty_html -> /usr/local/openresty/nginx/html |

## Deploy

### CLI

```bash
levelrail-cli templates deploy openresty --name my-openresty
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/openresty/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## First run
1. Open the public address to see the default page, then add content to the web root volume.

## Questions

### Can I deploy OpenResty on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for OpenResty, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image openresty/openresty:1.27.1.2-13-alpine-fat is what you deploy there.

Self-host OpenResty, OpenResty docker compose file, deploy OpenResty on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
