美文网首页
Docker-Nginx-个人博客

Docker-Nginx-个人博客

作者: 糖纸疯了 | 来源:发表于2023-09-12 00:02 被阅读0次

1-Nginx做底座

模板之家下载静态网页-上传到服务器上

1、先运行nginx
    docker run -d --name nginx nginx
2、进入运行的nginx,将nginx的配置保存到指定的目录
    docker container ls     (查看nginx的containerID)
    export NGINX_PATH=/apps/config/nginx
    mkdir -p $NGINX_PATH/conf       (创建自己的nginx配置目录)
    mkdir -p $NGINX_PATH/html       
    #mkdir -p $NGINX_PATH/conf/nginx.conf
    docker cp 43b9e86346b4aa2ed9:/etc/nginx/nginx.conf $NGINX_PATH/conf
    如果不更改,访问403权限拒绝
    chmod -R 755 $NGINX_PATH
    
3、停止nginx镜像(运行的目的是拷贝nginx配置信息)
    docker container stop 43b9e86346b4aa2ed9
    docker container rm 43b9e86346b4aa2ed9
    
4、修改相关的本地配置
    vim $NGINX_PATH/conf/nginx
    
5、添加主页展示页面
    echo "hello">$NGINX_PATH/html/index.html

6、运行挂载我们自己的配置文件
docker run -d -p 80:80 --name nginx-station-80 -v /root/html/html_template_train:/usr/share/nginx/html -v $NGINX_PATH/conf/nginx.conf:/etc/nginx/nginx.conf -v $NGINX_PATH/logs:/var/log/nginx nginx

相关文章

  • 个人博客

    欢迎大家访问我的个人博客网站:www.mjklose123.cn

  • 个人博客

    https://maxwellqi.github.io http://awhisper.github.io htt...

  • 个人博客

    个人博客:gorpeln.com

  • 个人博客

  • 个人博客

    个人博客 file:///C:/Users/Administrator/Desktop/HTML/%E4%B8%A...

  • 个人博客

    前几天在本地虚拟服务器环境下使用jQuery制作了一个个人博客,实现功能如下: 用户注册 用户登录&登出 发表博文...

  • 个人博客

    Hexo + Github 搭建的个人博客网站,经过个人优化后的主题 Next,欢迎感兴趣的小伙伴来跟我交流,一起...

  • 个人博客

    个人博客网址 常用的语言技术:nodejs/c#/go/linux ~欢迎交流~

  • 个人博客

    前言 前段时间搭建了个人博客,买了个域名,想着把云服务器资源利用起来,在此推广一下个人博客,后续文章在个人博客发布...

  • 个人博客

网友评论

      本文标题:Docker-Nginx-个人博客

      本文链接:https://www.haomeiwen.com/subject/tyyyvdtx.html