Posts

Showing posts with the label Linux

IT筆記 : Ubuntu 22.04 Linux 中安裝 Nginx web server

Image
在 Ubuntu官方網站下載 Ubuntu 22.04 ISO,視乎需要,可選擇Desktop image或者Server install image 的版本,兩者的分別是前者有圖象界面而後者沒有。 如果平時常用windows平台的話,可以採用Virtualbox或者 VMWare 來安裝ISO。 如果使用windows內置的WSL2以來安装則較為簡單,但是功能有少許限制,在這裏不作詳述了! 下載及安裝伺服器版本後再檢查Ubuntu 22.04有沒有更新版本 $ sudo apt update 如要更新可輸入指令更新 $ sudo apt upgrade 檢查時區即是 Time Zone 的設定 使用指令列出可用的時區。 $ timedatectl list-timezones 設置香港時區 $ sudo timedatectl set-timezone Asia/Hong_Kong $ timedatectl 輸入指令安裝 Nginx web server $ sudo apt install nginx  完成安裝後,使用指令顯示Nginx的版本。 $ nginx -v nginx version: nginx/1.18.0 (Ubuntu) 確認Nginx的版本為1.18.0 。 檢視防火牆的設定 $ sudo ufw app list  Output Available applications:   Nginx Full   Nginx HTTP   Nginx HTTPS   OpenSSH  輸入指令容許正常 HTTP traffic 通過 port 80 . $ sudo ufw allow 'Nginx HTTP'  輸入指令查看防火牆狀況 $ sudo ufw status  Output Status: active  To                         Action      From  --...

IT 筆記:在 Windows 10 Home WSL 安裝 LAMP

Image
LAMP是Linux系統上的網站架設組合,「L」表示「Linux」作業系統,「A」表示「Apache」網頁伺服器,「M」表示「MySQL」資料庫,「P」表示「PHP」程式語言, 上一集介紹了在windows 10 home安裝 WSL ,今次介紹在WSL系統之上安裝LAMP的方法。 輸入指令:sudo apt-get update,先將系統更新到最新版本。 輸入指令:sudo apt-get install lamp-server^  ,安裝LAMP Server。 使用root權限編輯主apache服務器配置文件 ;  sudo nano /etc/apache2/apache2.conf 在 /etc/apache2/apache2.conf 中添加以下2行: Servername localhost AcceptFilter http none 貯存 apache2.conf 文件 使用root權限,輸入指令:$ sudo /etc/init.d/apache2 start;重新啟動 apache2。 使用瀏覽器訪問測試頁面 http:// localhost或http://127.0.0.1 看到預設網頁,就表示Apache2 Server已經安裝成功了! 在/var/www/html創建新的「info.php」檔案  使用瀏覽器訪問測試頁面 http:// localhost/info.php 或 http://127.0.0.1/info.php 如果成功的話,會看到php安裝的資訊。 詢問 mysql 狀況: sudo service mysql status 如果顯示的信息是: * MySQL is stopped. 那麼輸入指令開始啟用 MySQL : sudo service mysql start 顯示 MySQL 已經啟用 * Starting MySQL database server mysqld 使用 root 登錄 mysql :sudo mysql -u root 在 MySQL prompt >, 輸入指令: sh...