跳到主要内容

Nginx Proxy Manager

官方网站

https://nginxproxymanager.com

一个Nginx可视化的项目,是几乎其他所有项目的反代之本。所以此项目是必装(替代项目有Nginx Web UI、 Nginx UI等)

其他项目都通过Nginx来进行反向代理,通过https的443端口进行公网访问。

Docker方式安装

compose文件

networks:
default:
external: true
name: ${DOCKER_MY_NETWORK}
services:
app:
image: jc21/nginx-proxy-manager:latest #latest #2.10.4
container_name: npm
restart: unless-stopped
ports:
- 80:80
- 81:81
- 443:443
# 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:
- ${DOCKER_HOME}/npm/data:/data
- ${DOCKER_HOME}/npm/letsencrypt:/etc/letsencrypt
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
networks:
default:
ipv4_address: 172.20.0.2
deploy:
resources:
limits:
cpus: "0.5"
memory: 300M

env文件

DOCKER_HOME=/home/mapan/docker
DOCKER_MY_NETWORK=npm_default

启动

docker compose up -d

备注

81端口是后台管理的页面,默认账户如下,需要手动重新配置用户名和密码。

admin@example.com 
changeme

第一次部署后,使用ip+端口的方式访问(需防火墙放行81端口),然后进入Proxy,对自身管理页面进行反向代理。

配置成功以后可以把compose文件中的81端口映射注释掉,再重新部署(防火墙再取消放行81端口)。