wcm2025 網際內容管理 Scrum-1 demo 網站

  • Home
    • SMap
    • reveal
    • blog
  • About
    • list
    • Fossil
  • Tasks
    • task1
    • task2
    • task2.5
      • IPv6
    • task3
      • mind-map
    • task4
  • Reeborg
    • Challenge
    • Tutorial
    • Examples
    • rb
      • Program
    • Packages
    • URL
      • Parameters
  • Homework
    • HW1
      • Steps
      • Commands
    • HW2
  • Midterm
  • Final
  • Brython
IPv6 << Previous Next >> mind-map

task3

使用 Nginx 建立全球資訊網伺服器

HTML 中的 CSS 與 Javascript

Windows 環境中的 WWW server

Ubuntu 環境中的 WWW server


Windows:

https://software.nfu.edu.tw/Windows/tw/Win_10_22H2.4_64BIT_Ch.ISO

http://229.cycu.org/win10.vdi 

利用 nssm 將 nginx.exe 設為系統服務

必須使用管理者的 cmd, 然後執行 nssm install nginx, nssm edit nginx, nssm remove nginx

nginx.conf 

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        # a0xx 中的 xx 為上課時的學員序號
        # https://mdewcm2025.github.io/hw-scrum-1/downloads/1a_stud.txt
        listen [2001:288:6004:17:fff1:cc25::a0xx]:80;
       # server_name  your-domain.com;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page 404 /404.html;
        location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }
}

Windows 利用 Letsencrypt 設定 https WWW 伺服器的套件工具: certbot.7z

安裝 certbot 之後關閉 WWW 伺服器, 然後利用管理者啟動的 cmd 執行的:

certbot certonly --standalone

就可以取得 privkey.pem 與 fullchain.pem 等兩個網站的 https 數位簽章.

與 nginx 結合設定的 nginx.conf 如下:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    # Redirect HTTP to HTTPS
    server {
        listen [2001:288:6004:17:fff1:cc25::a099]:80;
        server_name  w99.mde.nfu.edu.tw;

        return 301 https://$host$request_uri;
    }

    # HTTPS server
    server {
        listen [2001:288:6004:17:fff1:cc25::a099]:443 ssl;
        server_name w99.mde.nfu.edu.tw;

        ssl_certificate      C:/Certbot/live/w99.mde.nfu.edu.tw/fullchain.pem;
        ssl_certificate_key  C:/Certbot/live/w99.mde.nfu.edu.tw/privkey.pem;

        ssl_protocols        TLSv1.2 TLSv1.3;
        ssl_ciphers          HIGH:!aNULL:!MD5;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page 404 /404.html;
        location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }
}

在 Windows 利用 nssm 將 nginx 的啟動設為系統服務:

在管理者權限下執行 cmd (nssm 必須提供位於實體目錄下的 nssm.exe):

nssm install nginx

編輯 nginx 服務:

nssm edit nginx

檢視或管理系統服務:

以滑鼠右鍵點選"開始"後, 選擇"電腦管理", 即可開啟系統的"服務與應用程式".


將 https://github.com/mdecycu/reeborg.git 設為作業倉儲的 submodule (子模組) 的指令:

cd wcmhw (確定執行目錄為作業倉儲)

git submodule add https://github.com/mdecycu/reeborg.git reeborg

表示要將 https://github.com/mdecycu/reeborg.git 設為子模組, 且命名為 reeborg


Ubuntu:

ubuntu-24.04.2-live-server-amd64.iso

http://229.cycu.org/ubuntu.vdi 

Virtualbox:

VirtualBox-7.1.6-167084-Win.exe

Portable-Virtualbox.7z

在同一個 Virtualbox 設定下, 使用同一個 .vdi, 必須要先修改其 UUID:

"C:\Program Files\Oracle\VirtualBox\VBoxManage" internalcommands sethduuid c:\users\yen\downloads\win10.vdi


IPv6 << Previous Next >> mind-map

Copyright © All rights reserved | This template is made with by Colorlib