1.连接服务器
-
Ssh root@服务器地址连接远程服务器 -
Uname -a显示服务器信息 -
log out退出服务器
2.web服务器
- nginx
- apache
- 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