前提:环境为mac + 阿里云Alibaba Cloud Linux 3.2104 64位
本地文件上传到服务器
scp -r ~/Desktop/test_ng root@xx.xx.xx.xx:~/
# 上传目录到服务器
scp -r local_dir username@servername:remote_dir
# 上传本地文件到服务器
scp /path/filename username@servername:/path/
如果运行报错
可以运行该命令把相关ip内容删除
vi ~/.ssh/known_hosts
远程连接服务器
查看是否上传成功
ls
安装依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
安装Nginx
wget https://nginx.org/download/nginx-1.20.2.tar.gz
检查安装
ls
解压
tar -zxvf nginx-1.20.2.tar.gz
进入ng目录
cd nginx-1.20.2/
./configure --prefix=/usr/local/nginx
make install
检验
cd /usr/local/nginx/
ls
启动服务器
cd sbin/
./nginx
访问你的ip,出现nginx就是成功 记得打开你服务器的80端口
修改nginx配置
进入到上一级
cd ..
cd conf/
ls
编辑
vi nginx.conf/
点i进入编辑模式,修改location / 内容,修改为use root esc退出 :wq保存退出
// 回到sbin目录下操作
cd ..
cd sbin/
./nginx -s reload