此教程目前仅限于v1.31以及以上版本,低版本可能存在其他兼容问题
目前最新版本:0.1.4(原v1.4版本)
欢迎使用nuoyis-lnp docker版部署你的博客,使用该docker程序能快速部署你的网站或者博客系统
nuoyis-lnp优点
快,docker-compose up -d 就可部署完毕
稳定,nuoyis特有的健康检查方法,对不健康容器进行自动重启
防黑,nuoyis特有的版本号抹除,对黑客有一定的干扰性
弹性升级,nuoyis后续切换版本仅需在docker-compose内快速切换,快速回滚(docker特性)
###docker部署方法
拉取docker指令
1 2 3
| docker pull swr.cn-north-4.myhuaweicloud.com/nuoyis/nuoyis-lnp:v1.32 docker pull mariadb:latest docker pull willfarrell/autoheal
|
docker 运行
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
| docker network create --subnet=192.168.223.0/24 --gateway=192.168.223.1 nuoyis-net
docker run -d \ --name nuoyis-lnmp-np \ --network nuoyis-net \ --network-alias nuoyis-lnp \ -p 80:80 \ -p 443:443 \ -v /nuoyis-web/nginx/conf:/nuoyis-web/nginx/conf \ -v /nuoyis-web/nginx/webside:/nuoyis-web/nginx/webside \ -v /nuoyis-web/nginx/ssl:/nuoyis-web/nginx/ssl \ --health-cmd="curl -f http://localhost || exit 1" \ --health-interval=30s \ --health-retries=3 \ --health-start-period=10s \ --health-timeout=10s \ --restart always \ swr.cn-north-4.myhuaweicloud.com/nuoyis/nuoyis-lnp:v1.32
docker run -d \ --name nuoyis-lnmp-mariadb \ --network nuoyis-net \ --network-alias nuoyis-mariadb \ -e TIME_ZONE=Asia/Shanghai \ -e MYSQL_ROOT_PASSWORD="" \ -v /nuoyis-web/mariadb/init/init.sql:/docker-entrypoint-initdb.d/init.sql \ -v /nuoyis-web/mariadb/server:/var/lib/mysql \ -v /nuoyis-web/mariadb/import:/nuoyis-web/mariadb/import \ -v /nuoyis-web/mariadb/config/my.cnf:/etc/mysql/my.cnf \ -p 3306:3306 \ --health-cmd="sh -c 'mariadb -u root -p$$MYSQL_ROOT_PASSWORD -e \"SELECT 1 FROM information_schema.tables LIMIT 1;\"'" \ --health-interval=30s \ --health-retries=3 \ --health-start-period=10s \ --health-timeout=10s \ --restart always \ mariadb:latest
docker run -d \ --name nuoyis-lnmp-autoheal \ --network nuoyis-net \ -e AUTOHEAL_CONTAINER_LABEL=all \ -v /var/run/docker.sock:/var/run/docker.sock \ --restart always \ willfarrell/autoheal
|
docker-compose部署方法(需要自行设置mariadb root密码)
docker-compose.yaml
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| version: '2.32.2' services: nuoyis-lnmp-np: container_name: nuoyis-lnmp-np image: swr.cn-north-4.myhuaweicloud.com/nuoyis/nuoyis-lnp:v1.32 networks: nuoyis-net: aliases: - nuoyis-lnp ports: - 80:80 - 443:443 volumes: - /nuoyis-web/nginx/conf:/nuoyis-web/nginx/conf - /nuoyis-web/nginx/webside:/nuoyis-web/nginx/webside - /nuoyis-web/nginx/ssl:/nuoyis-web/nginx/ssl healthcheck: test: ["CMD", "curl", "-f", "http://localhost"] interval: 30s retries: 3 start_period: 10s timeout: 10s restart: always nuoyis-lnmp-mariadb: container_name: nuoyis-lnmp-mariadb image: mariadb:latest networks: nuoyis-net: aliases: - nuoyis-mariadb environment: TIME_ZONE: Asia/Shanghai MYSQL_ROOT_PASSWORD: "" volumes: - /nuoyis-web/mariadb/init/init.sql:/docker-entrypoint-initdb.d/init.sql - /nuoyis-web/mariadb/server:/var/lib/mysql - /nuoyis-web/mariadb/import:/nuoyis-web/mariadb/import - /nuoyis-web/mariadb/config/my.cnf:/etc/mysql/my.cnf ports: - 3306:3306 healthcheck: test: ["CMD", "sh", "-c", "mariadb -u root -p$$MYSQL_ROOT_PASSWORD -e 'SELECT 1 FROM information_schema.tables LIMIT 1;'"] interval: 30s retries: 3 start_period: 10s timeout: 10s restart: always nuoyis-lnmp-autoheal: container_name: nuoyis-lnmp-autoheal image: willfarrell/autoheal environment: - AUTOHEAL_CONTAINER_LABEL=all volumes: - /var/run/docker.sock:/var/run/docker.sock restart: always networks: nuoyis-net: driver: bridge ipam: driver: default config: - subnet: 192.168.223.0/24 gateway: 192.168.223.1
|
0.1.4(v1.4)版本以下conf文件引用方式
1 2 3 4
| # 最新版本 include start-php-84.conf; # 稳定版本 include start-php-81.conf;
|
0.1.4以上版本引用conf文件引用方式
1 2 3 4
| # 最新版本 include start-php-latest.conf; # 稳定版本 include start-php-stable.conf
|
后续更新中,请耐心等待