• 常看:华为服务器问题记录docker nginx


    (1)不同内核版本下载的docker 配置不一致
     提示:
    standard_init_linux.go:220: exec user process caused "exec format error" 
    下面这个链接有描述
    首先:docker pull nginx 
               docker run -d --name nginx-test --net host -it nginx

               curl localhost:80        
               看能不能启动
    然后打自己的docker-> build-> run (
    --net host )
    然后查看

    提示:默认文件为default.conf    修改我们文件包nginx.conf 改为default.conf  

    10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf

    然后查看默认 /etc/nginx/nginx.conf 权限 和当前用户权限比较 就是下面的了



    qemu-user-static:利用x86机器编译支持arm架构的docker镜像_1024小神的博客-CSDN博客
    (2)nginx.conf 指定权限问题 user  root; 不设置就为当前用户权限 比如test
    (3)问题 
     root  /usr/share/nginx/html;是nginx默认目录 
            如果没加上一行代码 也是默认添加这一行
      location / {
            如果在里面改成新建目录:如下
                  
      RUN mkdir -p /home/testconfig/dist/
                    #COPY dist /usr/share/nginx/html/
                    COPY dist /home/testconfig/dist/

           如果有  root  /usr/share/nginx/html; 然后设置这一行 ok 没有的话就不会从根目录开始
       
       alias /home/tools/dist/;

      }

    docker run -d --name nginx-test --net host -it nginx
    curl localhost:80
     netstat -apnult| grep 9013 查看 这个端口的调用情况
    cat 文件
    docker ps
    chmod -R 777 ./  -R 为./ 子目录添加权限
    ls -l 查看文件权限
    uname -r 查看 服务器内核
    docker exec -it d-base-tools /bin/bash 进入容器里面看


    使用docker内端口设置为服务器访问端口
    docker run --name d-base-tools -it -v /home/jialing.wu/nlp_expansion/nlp_expansion_front/config.js:/home/tools/dist/config.js --net host -d base-tools

    Dockerfile
    COPR nginx.conf /etc/nginx/ 覆盖原来的默认的nginx.conf文件 将权限root

    1. FROM nginx
    2. USER root
    3. MAINTAINER luan
    4. RUN mkdir -p /home/tools/dist/
    5. #COPY dist /usr/share/nginx/html/
    6. COPY nginx.conf /etc/nginx/
    7. COPY dist /usr/share/nginx/html/
    8. COPY default.conf /etc/nginx/conf.d/
    9. RUN mkdir -p /opt/nginx/logs/tools.msxf.lo/
    10. RUN echo 'echo init ok!!'


    nginx.conf

    1. user root;
    2. worker_processes auto;
    3. error_log /var/log/nginx/error.log notice;
    4. pid /var/run/nginx.pid;
    5. events {
    6. worker_connections 1024;
    7. }
    8. http {
    9. include /etc/nginx/mime.types;
    10. default_type application/octet-stream;
    11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    12. '$status $body_bytes_sent "$http_referer" '
    13. '"$http_user_agent" "$http_x_forwarded_for"';
    14. access_log /var/log/nginx/access.log main;
    15. sendfile on;
    16. #tcp_nopush on;
    17. keepalive_timeout 65;
    18. #gzip on;
    19. include /etc/nginx/conf.d/*.conf;
    20. }

    default.conf
    使用推荐docker版本的nginx.conf的配置 ,使用docker内端口设置为服务器访问端口
    docker run --name d-base-tools -it -v /home/jialing.wu/nlp_expansion/nlp_expansion_front/config.js:/home/tools/dist/config.js --net host -d base-tools

    1. server {
    2. listen 9104;
    3. listen [::]:9104;
    4. server_name localhost;
    5. #access_log /var/log/nginx/host.access.log main;
    6. add_header Access-Control-Allow-Origin *;
    7. add_header Access-Control-Allow-Headers X-Requested-With;
    8. add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
    9. location / {
    10. root /usr/share/nginx/html;
    11. index index.html index.htm;
    12. if ($request_filename ~* config\.(js)$) {
    13. add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
    14. }
    15. }
    16. location ^/(.*)\.(js|css|jpg|png|jpeg|svg|woff|ico|tff)$ {
    17. alias /home/tools/dist/;
    18. expires 30d;
    19. }
    20. #error_page 404 /404.html;
    21. # redirect server error pages to the static page /50x.html
    22. #
    23. error_page 500 502 503 504 /50x.html;
    24. location = /50x.html {
    25. root /usr/share/nginx/html;
    26. }
    27. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    28. #
    29. #location ~ \.php$ {
    30. # proxy_pass http://127.0.0.1;
    31. #}
    32. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    33. #
    34. #location ~ \.php$ {
    35. # root html;
    36. # fastcgi_pass 127.0.0.1:9000;
    37. # fastcgi_index index.php;
    38. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    39. # include fastcgi_params;
    40. #}
    41. # deny access to .htaccess files, if Apache's document root
    42. # concurs with nginx's one
    43. #
    44. #location ~ /\.ht {
    45. # deny all;
    46. #}
    47. }

    zkj数字警察备注:

    一、部署包安装

    交付部署包为docker压缩包:dialogue-police.tar,部署包需要部署在有docker环境的服务器上,docker建议版本:19.03.12。

    启动命令:

    服务器端口运维设置:9088

    容器端口:9013

    Docker名称: d-dialogue-police

    镜像名称:dialogue-police

    容器导入:docker load –i dialogue-police.tar

    之前:docker run --name d-dialogue-police -p 9088:9013 -d dialogue-police 2022.12.18: docker run -it -v /home/dialogue_police/dist/config.js:/usr/share/nginx/html/config.js -p 9088:9013 -d dialogue-police

    xxx:imagesid
    ssss:镜像仓库
    dialogue-police:镜像
    v2.1:tag

      docker build -t i-robot . 

    docker tag xxx ssss/dialogue-police:v2.1
    docker rmi harbor.maip.io/ai/dialogue-police:v2.1

    docker load -i dialogue-police.tar

    docker run --name d-dialogue-police -p 9088:9013 -d  harbor.maip.io/dialogue-police:v2.1.1

  • 相关阅读:
    Java智慧工地SaaS管理平台源码:AI/云计算/物联网
    java中的集合框架基础-5
    智算引领·创新未来 | 2023紫光展锐泛物联网终端生态论坛成功举办
    ES高亮显示语法
    R统计绘图-随机森林分类分析及物种丰度差异检验组合图
    OpenCV自学笔记二十五:K均值聚类
    uniapp-路由uni-simple-router
    精读《素书》精彩语录及感悟篇(二)
    Git常用方法
    基于JAVA开发的在线双人联机坦克大战小游戏
  • 原文地址:https://blog.csdn.net/weixin_41127362/article/details/127653563