湖濱散記部落格的樹心幽徑[login][主頁]
393:20180426在Ubutun安裝apache2網頁及sshd伺服程式並用pietty連線編寫一個網頁

(一)重啟0424的Ubuntu機器並設定網路組態(以firep登入,密碼abc123)

IP: 10.10.10.125

Mask: 255.255.255.0

Gateway: 10.10.10.254

DNS: 163.25.20.1

(二a)下載pietty並解壓到桌面:

(1)用pietty連10.10.10.125失敗

(2)在cmd執行sudo apt-get install ssh 來安裝sshd

(3)用pietty連10.10.10.125仍失敗(但本機已可登入)

(4)在cmd執行sudo vi /etc/ssh/sshd_config修改設定如下:

(5)在cmd執行sudo ufw disable停用防火牆

(6)在cmd執行sudo vi /etc/hosts.allow ,

加入下行

sshd: 10.10.10.166:allow

(7)在cmd執行sudo /etc/init.d/ssh restart

來重啟sshd (本機可連線)

(8)用pietty連10.10.10.125失敗3

(9)在cmd執行reboot重開機

(10)用pietty連10.10.10.125成功

(11)請同學下載pietty來連線10.10.10.125皆成功

用firep登入(密碼abc123), 選項/字元編碼/挑「UTF8」,輸入exit結束pietty

再登入一次確認可以。

(二b)執行cmd/輸入安裝指令

sudo apt-get install apache2

安裝中…成功

(1)用firefox 連10.10.10.125成功看到了預設網頁

本頁擺在 /var/www/html/index.html

(三)用pietty以firep登入10.10.10.125

(1)sudo chmod 777 /var/www/html (設定為任何人皆可編修網頁主目錄)

(2)輸入vi  /var/www/html/s座號.html

按i鍵進入編輯模式,再輸入座號77,按ESC ,再按:wq存檔

(3)用firefox 連10.10.10.125/s77.html

(4)請同學再輸入vi  /var/www/html/s座號.html來編輯加如下三行HTML碼

按i鍵進入編輯模式,

<body bgcolor=red>

peace平靜(自訂文字)

</body>

按ESC ,再按:wq存檔

(5)再用firefox 連10.10.10.125/s77.html成功

10.10.10.125/s08.html成功

10.10.10.125/s32.html成功

10.10.10.125/s31.html成功

 


select id,article_id,topic,text from lt_articles_text where article_id =393; ok. update lt_articles set num_reads=num_reads +1 where id=393; ok.