winney

It is never too old to learn.

0%
winney

云服务器-常用命令

登录云服务器:

1
ssh user@server_ip

user 替换为您的用户名,server_ip 替换为服务器的 IP 地址或主机名。

复制文件到云服务器:

1
scp local_file user@server_ip:remote_path

local_file 替换为本地文件路径,user 替换为您的用户名,server_ip 替换为服务器的 IP 地址或主机名,remote_path 替换为服务器上的目标路径。

从云服务器复制文件到本地:

1
scp user@server_ip:remote_file local_path

user 替换为您的用户名,server_ip 替换为服务器的 IP 地址或主机名,remote_file 替换为服务器上的源文件路径,local_path 替换为本地目标路径。

上传文件到云存储(如 AWS S3 或腾讯云 COS):

1
aws s3 cp local_file s3://bucket_name/remote_path

1
coscmd upload local_file remote_path bucket_name

这些命令将本地文件上传到云存储桶(bucket)中

下载云存储中的文件到本地:

1
aws s3 cp s3://bucket_name/remote_file local_path

1
coscmd download bucket_name remote_file local_path

查看服务器状态:

1
systemctl status service_name

service_name 替换为您要查看状态的服务名称,例如 nginxapache2 等。

启动、停止或重启服务:

1
2
3
sudo systemctl start service_name
sudo systemctl stop service_name
sudo systemctl restart service_name

查看服务器资源使用情况:

1
top

查找文件所在位置:

1
locate 文件名

修改了nginx的配置:

  1. 确保配置语法没有错误:sudo nginx -t

    1
    2
    3
    [root@VM-8-7-centos private]# sudo nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
  2. nginx -s reload

    Nginx 服务器 SSL 证书安装部署

有缓存,需要等半个小时以上