docker安装nginx
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
·
前言
本篇内容来自B站《谷粒商城》
docker安装nginx
查看docker镜像
docker images

创建文件夹
根目录创建文件夹 mydata,在 mydata下创建文件夹nginx;运行docker镜像
# 创建文件夹
mkdir nginx
# 运行镜像文件
docker run -p 80:80 --name nginx -d nginx:1.10
将docker容器文件拷贝出来
将容器内的配置文件拷贝到当前nginx目录,获取nginx目录结构(注意此时我们的位置在mydata文件夹下)
docker container cp nginx:/etc/nginx .

停止nginx容器并删除
docker stop nginx
docker rm nginx

重命名将nginx文件夹为conf
mv nginx conf
再次创建nginx文件夹
mkdir nginx
将conf移动到nginx
mv conf nginx/
再次创建docker实例
docker run -p 80:80 --name nginx \
-v /mydata/nginx/html:/usr/share/nginx/html \
-v /mydata/nginx/logs:/var/log/nginx \
-v /mydata/nginx/conf:/etc/nginx \
-d nginx:1.10

设置开机启动
docker update nginx --restart=always
访问nginx首页
默认端口80
新建index.html文件

touch index.html
vim index.html
编辑index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>Document</title>
<h1>
Hello Nginx
</h1>
</html>
再次访问

A beautiful web dashboard for Linux
最近提交(Master分支:4 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐


所有评论(0)