# Google GCP VM設定 ## 機器設定 > 選一代 隨意選 ![](https://hackmd.io/_uploads/S1B96HrX2.png) ## 開機磁碟 UBANTU // 18.04 防火牆兩個都打勾 ![](https://hackmd.io/_uploads/rylspBBXn.png) ## 打開GCP終端機 ![](https://hackmd.io/_uploads/H1ts6BHm2.png) 選擇在瀏覽器開啟 ## 安裝NVM ``` sh= curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash nvm install #14 (可選,NODE的版本) ``` ## 安裝NodeJS ``` sh # 參考網址:https://github.com/nodesource/distributions # Using Ubuntu NodeJS v14.x curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install -y nodejs ``` ## 安裝pm2 ``` sh= npm install -g pm2 ``` ## 安裝git ``` sh= sudo apt update sudo apt install git ``` ## 安裝Nginx ``` sh= sudo apt update sudo apt install nginx ``` ## 設置固定IP流程 ![](https://hackmd.io/_uploads/SJWTarHm2.png) >把臨時設置為靜態 ![](https://hackmd.io/_uploads/BJap6HrXh.png) ![](https://hackmd.io/_uploads/H1hCaHBXh.png) >選加入> 類型選A > 主機位置在GCP的外部地址中 ![](https://hackmd.io/_uploads/Sy_x0BS7h.png) ## Nginx 反向代理參數設定 進入conf.d資料夾,去設定Nginx反向代理的參數 ``` sh= cd /etc/nginx/conf.d sudo nano yourdomain.conf ``` >配置服務 ``` nano= server { server_name yourdomain www.yourdomain; location / { proxy_pass http://localhost:8080; } } ``` >部屬靜態網頁 ``` nano= server { server_name vue.jimmyy512.com; location / { root HTML絕對路徑(可以透過pwd指令查詢HTML在機器上的路徑); index index.html index.htm; } } ``` ## Nano反白刪除 First, you need to press CTRL + Shift + 6 to mark the start of your block Now, shift the cursor to the end of the block with the arrow keys, and it will outline the text. Finally, press CTRL + K to cut/delete a block and it will remove a line in nano.