• 项目部署问题汇总


    Mac和Linux远程连接服务器异常修复(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

    一、今天在使用SSH,连接远程服务器的时候,刚开始是没问题的。
    后来阿里云主机重装了一下系统后,再也连不上了。一直报一个错。

    ~ ⌚ 22:49:52
    $ ssh root@47.98.233.15
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
    The fingerprint for the ECDSA key sent by the remote host is
    SHA256:8hgJ8jpcBr1tm6HS72FpXwMrjba8MQqlqYJQLPB/Qf4.
    Please contact your system administrator.
    Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
    Offending ECDSA key in /Users/wangdong/.ssh/known_hosts:26
    ECDSA host key for 47.98.233.15 has changed and you have requested strict checking.
    Host key verification failed.

    二、解决方法,看错误日志中有一句

    Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
    三、以编辑器的方式进入这个文件

    vi /Users/wangdong/.ssh/known_hosts
    四、将红线框部分删除掉


    五、再次进行远程连接

    ~ ⌚ 22:52:18
    $ ssh root@47.98.233.15
    The authenticity of host '47.98.233.15 (47.98.233.15)' can't be established.
    ECDSA key fingerprint is SHA256:8hgJ8jpcBr1tm6HS72FpXwMrjba8MQqlqYJQLPB/Qf4.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '47.98.233.15' (ECDSA) to the list of known hosts.
    root@47.98.233.15's password:
    Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-105-generic x86_64)

    * Documentation: https://help.ubuntu.com
    * Management: https://landscape.canonical.com
    * Support: https://ubuntu.com/advantage

    Welcome to Alibaba Cloud Elastic Compute Service !

    root@iZbp17cj14ulhfrlj02rkaZ:~#

    问题就解决了,原因是因为才重装系统后,再次进行远程连接上,在输入yes后,本机会将远程机器的信息,写到/Users/wangdong/.ssh/known_hosts文件中,所以如果远程重装系统了,本机一定要先清理掉。
    ————————————————
    版权声明:本文为CSDN博主「向小凯同学学习」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/wd2014610/article/details/79945424

    =========

    ```js
    upstream blog {
        server 127.0.0.1:8000;
    }
    proxy_cache_path /cache levels=1:2 keys_zone=cache:10m max_size=10g inactive=60m use_temp_path=off;
    server {
        listen 80;
        server_name www.blog.xiaozhumaopao.com;
        #开启gzip压缩start
        gzip on;
        gzip_min_length 1k;
        gzip_buffers 4 16k;
        #gzip_http_version 1.0;
        gzip_comp_level 8;
        gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif;
        gzip_vary off;
        gzip_disable "MSIE [1-6].";
        #开启gzip压缩end
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Nginx-Proxy true;
            proxy_set_header   X-Forwarded-Host $server_name;
    
            proxy_pass http://blog;
            proxy_redirect off;
    
            #配置缓存start
            proxy_cache cache;
            proxy_cache_valid   200 304 12h;
            proxy_cache_valid   any 10m;
            add_header  Nginx-Cache "$upstream_cache_status";
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            #配置缓存end
        }
    }
    
    
    ```

     3.如果每次提交代码到服务器 都提示正在运行 pm2,还有关闭服务后,无法请求接口:

    1 配置文件中:

    "post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production", //项目发布到服务器上执行的命令
     
    2.增加 processes.json文件
    {
        "apps": [
          {
            "name": "myblog",
            "cwd": "./",
            "script": "./bin/www",
            "log_date_format": "YYYY-MM-DD HH:mm Z",
            "error_file": "/var/log/node-app/node-app.stderr.log",
            "out_file": "log/node-app.stdout.log",
            "pid_file": "pids/node-geo-api.pid",
            "instances": 6,
            "min_uptime": "200s",
            "max_restarts": 10,
            "max_memory_restart": "1M",
            "cron_restart": "1 0 * * *",
            "watch": false,
            "merge_logs": true,
            "exec_interpreter": "node",
            "exec_mode": "fork",
            "autorestart": false,
            "vizion": false
          }
        ]
      }

    如何解决出现 unable to resolve host 问题 . https://www.jianshu.com/p/a46795929d1e

  • 相关阅读:
    多态
    多继承
    传宗接代——继承
    解决vue项目更新版本后浏览器的缓存问题
    escape()、encodeURI()、encodeURIComponent()三种编码方式的区别
    epoll使用总结
    探讨c/c++的指针
    基于linux的pthread_t封装一个Thread类
    unix高并发编程中遇到的问题和笔记
    面向对象分析与设计 实验七
  • 原文地址:https://www.cnblogs.com/xiaozhumaopao/p/11775431.html
Copyright © 2020-2023  润新知