--- tags: dsc Author: uccu --- # 10/19-GCP實作 ## Overview 建立GCP專案,利用compute engine建立虛擬機,並利用 nginx 建立 web server ## Setup 1. 進入 [GCP](https://console.cloud.google.com) 網站 2. 登入google帳號 3. 點擊免費試用建立帳號  ## 建立GCP專案 1. 點選上方選取專案 -> 新增專案  2. 輸入專案名稱後點擊建立  ## 建立Compute Engine 1. 點擊console左上角 -> Compute Engine -> VM執行個體  2. 點選建立  - 名稱: webserver - 區域(Region): asia-east1(台灣) - 區域(Zone): asia-east1-b - 機器設定 - 系列: N1 - 機器類型: f1-micro  3. 開機磁碟 -> 映像檔 -> 點擊變更  4. 作業系統: Ubuntu 5. 版本: Ubuntu 20.04 LTS 6. 點擊選取  7.防火牆 - 允許HTTP流量 - 允許HTTPS流量 8. 點選建立  ## 建立nginx server 1. 進入VM執行個體 -> 點選連接SSH  2. 點選開啟的ssh頁面 3. 更新伺服器 ```shell= sudo apt-get update ``` 4. 安裝nginx ```shell= sudo apt-get install nginx -y ``` 5. 檢查nginx是否正確開啟 ```shell= systemctl status nginx ```  6. 回到console頁面 7. 進入VM執行個體 -> 查看IP  8. 開啟瀏覽器,輸入網址後送出 - http://<外部IP位址>  9. 檢查nginx是否正常運作  ## 增添網頁內容 [網頁檔案(github)](https://github.com/uccuz/DSCNCU-Web) 1. 開啟ssh頁面 2. 回到家目錄 ```shell= cd ``` 3. 下載網頁檔案 ```shell= git clone https://github.com/uccuz/DSCNCU-Web.git ``` 4. 檢查是否下載成功 ```shell= ls ```  5. 將網頁資料移動到正確位置 ```shell= sudo mv DSCNCU-Web/* /var/www/html ``` 6. 開啟瀏覽器,輸入網址後送出 - http://<外部IP位址>  ## 刪除專案 1. 選擇要刪除的專案 2. 點擊右上角 -> 專案設定  3. 點選關閉 4. 輸入專案ID後點選關閉 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up