nginx

Web server and reverse proxy, serving /usr/local/www.

WebTested on FreeBSD1.30.6,3BSD-2-Clause

jailops app install nginx

Add --dry-run to see every step first. From the console: open Apps, pick nginx and press Install; the dialog takes the jail name, the network and the storage, and Preview steps shows the plan before anything runs. See the console.

About

nginx is a small, fast web server and reverse proxy. The package installs the server with its dynamic modules and a default site under /usr/local/www/nginx-dist, which this definition copies to /usr/local/www/nginx, the root of the default configuration; the configuration lives in /usr/local/etc/nginx/nginx.conf and is checked (nginx -t) before every start and reload.

What you get

Ports

  • 80/tcp http exposeHTTP, the default site.
  • 443/tcp httpsHTTPS; not configured until a certificate and a server block are added.

Data on its own datasets

  • /usr/local/www volume usr-local-wwwThe sites; the default site is nginx, copied from nginx-dist.

Configuration

  • /usr/local/etc/nginx/nginx.confThe server configuration; 'service nginx reload' applies most changes without a restart. Restart: service nginx restart.

Logs

  • /var/log/nginx/access.logOne line per request.
  • /var/log/nginx/error.logErrors and warnings of the server.

Health check

HTTP: GET :80/ answers 200, retried for up to 30 seconds.

Services

  • nginx: enabled and started

Setup, once, before the first start

Two commands, run in the jail as argv, without a shell:

  1. /bin/mkdir -p /usr/local/www/nginx
  2. /bin/cp -Rn /usr/local/www/nginx-dist/. /usr/local/www/nginx/

After the installation

The notes of the definition, shown after the installation too.

Put the site under /usr/local/www and its server block in /usr/local/etc/nginx/nginx.conf; run service nginx reload inside the jail to apply a change. Add a certificate before enabling the https port.

How it connects

jailops app allow nginx from @web

This opens the ports 80/tcp, 443/tcp of this app to the jail web, and nothing else. The service itself must listen on the jail's address and accept the client.

An installed app is closed: nothing reaches it, not even its own network, until you allow a source. A source is a jail (@web), a jail of another project (@project/web), an address set, an address or prefix, or host. jailops app access nginx lists who may connect. The names here are jail names: jailops app install names the jail after the app unless --name says otherwise.