Nginx【Docker系列】一个反向代理神器——Nginx Proxy Manager

 nginx 安装docker

安装Docker、Docker-compose

更新、安装必备软件

apt-get update && apt-get install -y wget vim

安装docker:非大陆Docker安装

wget -qO- get.docker.com | bash

查看Docker版本

docker -v

开机自动启动

systemctl enable docker

卸载Docker

sudo apt-get purge docker-ce docker-ce-cli containerd.io

sudo rm -rf /var/lib/docker

sudo rm -rf /var/lib/containerd

非大陆Docker-compose安装

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version


强烈建议大家专门给Docker的数据、配置文件新建一个文件夹

mkdir -p data/docker_data

----------

docker 安装 nginx

mkdir /root/data/docker_data/NPM

nano docker-compose.yml

配置代码

version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql

运行命令:

cd /root/data/docker_data/NPM

docker-compose up -d

登录niginx

ip:81

登录账号和密码

Email:    admin@example.com

Password: changeme


评论

此博客中的热门博文

又一款美国免费主机,无限流量动态X10hosting

这个网盘不限速,而且支持临时分享