Docker反向代理神器Nginx Proxy Manager安装教程
官网地址:Nginx Proxy Manager
一、创建Nginx Proxy Manager文件夹
在Docker文件夹下面创建Portainer子文件夹
mkdir -p /docker/NginxProxyManager
进入portainer文件夹
cd /docker/NginxProxyManager
二、在文件夹下面创建docker-compose文件并运行
本次安装需要使用到服务器的80端口和443端口和81端口,查询端口端口是否被占用
lsof -i:80
lsof -i:81
lsof -i:443
创建docker-compose.yml文件
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
按提示输入control键和X键退出,并输入Y保存
使用命令启动Nginx Proxy Manager
docker-compose up -d
查看程序是否运行
docker ps
三、界面介绍
输入你的服务器ip或域名加端口号就可以访问Nginx Proxy Manager面板了。如:http://1.1.1.1:81
默认邮箱:admin@example.com
默认密码:changeme
首次进入会提示你修改用户名、邮箱以及密码。按提示进行修改。