2021年12月16日 星期四

[Linux] Vue 部署流程

webber0928

最近要部署一台新的 Server, 想說這次把它做一個紀錄好了

Server: Ubuntu 20.04.3 LTS



# 更新系統並安裝 nginx
sudo apt -y update && sudo apt -y upgrade;
sudo apt install nginx;
# 安裝 node 14 LTS
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash;
source ~/.bashrc;
nvm install 14;
# 建立 ssh key
ssh-keygen -t rsa -b 4096 -C "yourMail@gmail.com";
# 啟動 nginx
sudo service nginx start
view raw deploy.sh hosted with ❤ by GitHub
# /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/MyWeb;
server_name xxx.xxx.xxx;
#server_name _;
location ^~ / {
index index.html index.htm;
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^.*$ /index.html last;
}
location /admin-api/ {
proxy_pass http://xx.xx.xx.xx/apis/admin/v1/;
}
}
view raw nginx.config hosted with ❤ by GitHub


就這樣。



By webber0928

一個小菜鳥工程師,對籃球還有夢想的男孩。

0 意見:

張貼留言

Coprights @ 2016, Blogger Templates Designed By Templateism | Distributed By Gooyaabi Templates