服务器连接

1.连接服务器

  1. Ssh root@服务器地址连接远程服务器
  2. Uname -a显示服务器信息
  3. log out 退出服务器

2.web服务器

  1. nginx
  2. apache
  3. tomcat php
2.1 安装nginx

yum install nginx

2.2 配置服务器

user nginx -> user root
http server location

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

vim /etc/nginx/nginx.conf

image.png

image.png

:set nu vim模式下出现行号

3. 上传服务到服务器

使用scp命令scp -r ./* root@ip:/root/www
服务器端和本地都要有scpyum install openssh-cli

ps -ef | grep nginx查看一下当前再跑的进程

image.png

nginx -c /etc/nginx/nginx.conf如果下面那句话报错
nginx -s stop把nginx停止
nginx运行nginx

3.出问题了

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:NHg/pDwRdtQThZzY3Z4Uwq/Rz93FgmL3UdBAFleWFWk.
Please contact your system administrator.
Add correct host key in /Users/yuanting/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/yuanting/.ssh/known_hosts:102
ECDSA host key for 192.168.198.190 has changed and you have requested strict checking.
Host key verification failed.

因为服务器的ip发生变更了
第一次SSH连接时,会生成一个认证,储存在客户端(也就是用SSH连线其他电脑的那个,自己操作的那个)中的known_hosts,但是如果服务器验证过了,认证资讯当然也会更改,服务器端与客户端不同时,就会跳出错误啦。

解决办法:删除留存的秘钥

输入命令:ssh-keygen -R +输入服务器的IP
例如:
 ~  ssh-keygen -R 192.168.198.147                                                                                                                                                                ✔
# Host 192.168.198.147 found: line 36
/Users/renwoxing/.ssh/known_hosts updated.

转:https://blog.csdn.net/qq_21127151/article/details/105237218

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容