打开iterm终端,在Profiles中加入服务器地址
再通过命令行,进入到服务器内部,添加nginx配置
ssh root@服务器ip地址
在根目录下找 nginx.conf名字的nginx配置文件执行命令
find / -name nginx.conf
打开nginx 配置文件,进行代理配置
vim /usr/local/nginx/conf/nginx.conf
server {
listen 81;
sever_name localhost;
location @router{
rewrite ^.*$ /index.html last;
}
location /{
try_files $uri $uri/ @router;
root /data/volunteer/dist/;
index index.html;
}
location /api {
#proxy_pass http://localhost:8089;
proxy_pass http://gzh.xayrzyz.cn;
}
}
上传命令,将本地的dist,上传到某服务器root账号下的new7文件夹下
scp -r dist root@服务器ip地址:/data/html/new7
重启nginx
nginx -s reload