Post

Nginx Proxy Manager

Expose your private network Web services and get connected anywhere. Built-in Let’s Encrypt support allows you to secure your Web services at no cost to you. Configure other users to either view or manage their own hosts. Full access permissions are available.

Default Nginx Proxy Manager login and password:

1
2
Username: admin@example.com
Password: changeme

Create docker-compose.yml for Nginx

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
version: "3.4"
services:
  nginx:
    image: jc21/nginx-proxy-manager:latest
    container_name: nginx-proxymanager
    restart: unless-stopped
    env_file: .env
    ports:
      - 80:80
      - 81:81
      - 443:443
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    environment:
      TZ: '${TIMEZONE}'
      DB_MYSQL_HOST: "mariadb-nginx"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "${MYSQL_USER}"
      DB_MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
      DB_MYSQL_NAME: "${MYSQL_DATABASE}"
      DISABLE_IPV6: 'true'
    depends_on:
      - mariadb-nginx
    networks:
      - proxy
  mariadb-nginx:
    image: jc21/mariadb-aria:latest
    container_name: mariadb-nginx
    restart: unless-stopped
    env_file: .env
    environment:
      TZ: '${TIMEZONE}'
      MYSQL_ROOT_PASSWORD: '${ROOT_PASSWORD}'
      MYSQL_DATABASE: '${MYSQL_DATABASE}'
      MYSQL_USER: '${MYSQL_USER}'
      MYSQL_PASSWORD: '${MYSQL_PASSWORD}'
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      - proxy

networks:
  proxy:
    external: true

Run this commands to set the variables

1
2
3
4
5
6
7
8
# Add variables for the docker images
TIMEZONE="$(cat /etc/timezone)"
PUID="$(id -u "${SUDO_USER:-$USER}")"
PGID="$(id -g "${SUDO_USER:-$USER}")"
ROOT_PASSWORD="$(gpg --gen-random --armor 1 20)"
MYSQL_DATABASE="$(gpg --gen-random --armor 1 6)"
MYSQL_USER="$(gpg --gen-random --armor 1 6)"
MYSQL_PASSWORD="$(gpg --gen-random --armor 1 14)"

Create .env to store the variables for docker-compose.yml

1
2
3
4
5
6
7
8
9
10
# Create .env file
cat <<EOF > /home/"${SUDO_USER:-$USER}"/docker/.env
TIMEZONE="${TIMEZONE}"
PUID="${PUID}"
PGID="${PGID}"
ROOT_PASSWORD="${ROOT_PASSWORD}"
MYSQL_DATABASE="${MYSQL_DATABASE}"
MYSQL_USER="${MYSQL_USER}"
MYSQL_PASSWORD="${MYSQL_PASSWORD}"
EOF
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.