Oauth2 原理 <<
Previous Next >> Ubuntu設定
Nginx
利用 http 301 設定將 http 連線導向 https 網站.
301 redirect:
server {
listen [::]:80 default ipv6only=on;
server_name pj5073.cycu.org;
return 301 https://$server_name$request_uri;
}
Autoindex:
利用簡單的帳號密碼, 保護 autoindex 目錄:
使用 htpasswd.exe 建立 .htpassword
而 htpasswd.exe 來自 Apache, 可以從 https://archive.apache.org/dist/httpd/binaries/win32/ 下載 .msi 後, 以 https://www.legroom.net/software/uniextract 轉出安裝後的目錄內容, 其中的 bin 目錄中包含 htpasswd.exe
htpasswd.exe 用法 htpasswd -c .htpasswd account
系統會詢問對應密碼, 然後完成 .htpasswd 檔案的建立.
Nginx 中 nginx.conf 則加入 port 88 網站的設定:
server {
listen [::]:88 default ipv6only=on;
server_name pj5073.cycu.org;
root C:/pj5073_data;
auth_basic "KMOLab Login";
auth_basic_user_file C:/pj2022/nginx-1.20.1/conf/.htpasswd;
location / {
autoindex on;
}
Oauth2 原理 <<
Previous Next >> Ubuntu設定