HUB
Sign inSign up

look4/nginx

By look4

•Updated almost 2 years ago

nginx, with modsecurity3, geoip2, and brotli compression

Image
Security
Web servers
0

601

look4/nginx repository overview

⁠What contains images

  1.27.3      nginx 1.27.3 (QUIC enabled; autoindex_module and http_ssi_module removed)
              njs 0.8.7
              modSecurity 3.0.13
              modSecurity Connector 1.0.3
              GeoIP2 3.4
              Latest Google brotli module from github

⁠Installation with podman and systemd

On a fresh installed Ubuntu 24.04

Prepare user

  $ useradd -m nginx
  $ loginctl show-user nginx | grep ^Linger
  $ loginctl enable-linger nginx
  

Prepare folder stucture

  $ mkdir -p /opt/nginx /opt/nginx/conf /opt/nginx/ssl /opt/nginx/logs /opt/nginx/www
  $ chown nginx:nginx /opt/nginx/* -R
  $ chmod 770 /opt/nginx /opt/nginx/conf /opt/nginx/ssl /opt/nginx/logs
  $ chmod 775 /opt/nginx/www

As nginx is running rootless you need to add 443 unprivileged port in systctl.conf

  $ sysctl -w net.ipv4.ip_unprivileged_port_start=443
  $ sysctl -w net.ipv6.ip_unprivileged_port_start=443

Create container file for systemd

  $ nano nginx.container

  [Unit]
  Description=Look4 nginx container
  Wants=network-online.target
  After=network-online.target
  
  [Container]
  Image=docker.io/look4/nginx:1.27.3
  PublishPort=443:443/tcp
  PublishPort=443:443/udp
  Volume=/opt/nginx/conf:/opt/nginx/conf
  Volume=/opt/nginx/logs:/opt/nginx/logs
  Volume=/opt/nginx/ssl:/opt/nginx/ssl
  Volume=/opt/nginx/www:/opt/nginx/www
  Timezone=Europe/Luxembourg
  
  [Service]
  Restart=always

  [Install]
  WantedBy=default.target


  nginx@server1:~$ mkdir -p ~/.bashrc.d
  nginx@server1:~$ echo "export XDG_RUNTIME_DIR=/run/user/$(id -u)" > ~/.bashrc.d/systemd 
  nginx@server1:~$ source ~/.bashrc.d/systemd

Activate container with sysmted quatled

  nginx@server1:~$ ln -s /opt/nginx/nginx.container /home/nginx/.config/containers/systemd/nginx.container

Reload container file

  nginx@server1:~$ systemctl --user daemon-reload

Start daemon as user nginx

  nginx@server1:~$ systemctl --user restart nginx && systemctl --user status nginx

⁠Update to a newer image

To pull a new image modify image version in /opt/nginx/nginx.container then reload systemd daemon and restart service like

  nginx@server1:~$ systemctl --user daemon-reload
  nginx@server1:~$ systemctl --user restart nginx && systemctl --user status nginx

Tag summary

Content type

Image

Digest

sha256:e3f963103…

Size

224.8 MB

Last updated

almost 2 years ago

docker pull look4/nginx:1.27.4