彻底搞懂反向代理神器Nginx Proxy Manager的配置和使用,一键配置反向代理、重定向、SSL、Nginx认证、404等,谁看了谁都会配置Nginx

https://blog.fanjunyang.zone/archives/nginx-proxy-manager

文末视频

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
安装环境配置

sudo yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装环境配置 添加仓库

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
安装docker

sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.0/docker-compose-‘uname -s’-‘uname -m’> /usr/local/bin/docker-compose

sudo curl -SL https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose
修改权限

docker compose version
查看docker compose版本

sudo systemctl start docker
启动docker

docker images
查看本地镜像库

docker ps
查看当前实例化的容器

docker ps -a
查看所有实例容器

sudo docker run hello-word
运行镜像创建实例容器

docker rm xxx
删除容器(xxx为实例容器ID前几位,能唯一表示要删除的实例容器即可)

docker rmi xxx
删除镜像(xxx为镜像ID前几位,能唯一表示要删除的镜像即可)

vi /etc/docker/daemon.json
添加镜像源
按i编辑
添加以下内容:
{
“registry-mirrors”:[“https://registry.docker-cn.com”]
}
按ESC退出编辑模式,按:wq 保存并退出

systemctl daemon-reload
systemctl restart docker
systemctl restart docker.service
重启docker

 

curl -L https://get.daocloud.io/docker/compose/releases/download/v2.1.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

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

docker compose version
查看 docker-compose 版本

sudo curl -L https://get.daocloud.io/docker/compose/releases/download/

curl -SL https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
restart docker

hostnamectl set-hostname hotgate –transient
hostnamectl set-hostname hotgate

portainer.io
hostnamectl
系统信息
timedatectl set-timezone Asia/Shanghai
systemctl enable docker
设置开机自启动

systemctl stop docker
systemctl stop docker.socket
systemctl restart docker

systemctl start docker
docker -v

pwd
查看当前目录返回/root/docker/data/nginx_proxy_manager

vi docker-compose.yml
创建dockerfile参考:https://nginxproxymanager.com/setup/#running-the-app
按i进行编辑,按ESC退出编辑模式,输入:wq保存退出
内容如下(汉化版):
version: ‘3.8’
services:
app:
image: ‘chishin/nginx-proxy-manager-zh: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

# Uncomment the next line if you uncomment anything in the section
# environment:
# Uncomment this if you want to change the location of
# the SQLite DB file within the container
# DB_SQLITE_FILE: “/data/database.sqlite”

# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: ‘true’

volumes:
– ./data:/data
– ./letsencrypt:/etc/letsencrypt

docker compose up -d
运行安装

 

 

 

发表评论