# Online Judge 部署 & HTTPS 設定教學 ## Clone the repo ref: [青島大學 OnlineJudge](https://github.com/QingdaoU/OnlineJudge) ```bash git clone -b 2.0 https://github.com/QingdaoU/OnlineJudgeDeploy.git cd OnlineJudgeDeploy ``` ## 取得 SSL 證書 由於之前的教學使用的 zerossl 開始要收費,這邊是用 let's encrypt 所維護的 certbot 工具來取得 ssl 證書 :::warning 先確認你有安裝 [brew](https://brew.sh) ::: ### 安裝 certbot ```bash brew install certbot ``` :::warning 可能會安裝一陣子 請有耐心 ::: ### 生成SSL證書 :::warning 執行這步前先確認目前 80 port 沒有在被使用中,如果你前面不小心把 docker run 起來了話,請先停用它 ::: ```bash sudo certbot certonly --standalone ``` 照著提示輸入 email (亂填應該沒差) 還有要註冊的域名 e.g. mozart.ee.ntu.edu.tw 最後應該就會出現以下資訊: ```bash Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/mozart.ee.ntu.edu.tw/fullchain.pem Key is saved at: /etc/letsencrypt/live/mozart.ee.ntu.edu.tw/privkey.pem This certificate expires on 2024-02-19. These files will be updated when the certificate renews. ``` ## 網站啟用 HTTPS 把上一步產生的 `fullchain.pem` 跟 `privkey.pem` 傳進 `OnlineJudgeDeploy/data/backend/ssl`裡 ```bash sudo cp /YourPathTo/fullchain.pem data/backend/ssl/server.crt sudo cp /YourPathTo/privkey.pem data/backend/ssl/server.key sudo chmod 666 data/backend/ssl/server.* ``` 打開`docker-compose.yml`把其中`FORCE_HTTPS=1`取消註解 ## OJ 啟動! ```bash sudo docker-compose up -d ``` :::warning 如果跳錯可能是 docker 沒打開,這兩台 mac mini 都是裝 GUI 版的 docker engine == ::: :::danger 90 天候證書過期可以回到 [生成 SSL 證書](###生成SSL證書) 這步更新 :::
×
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