2023年9月13日 星期三

RaspberryPi Lite 32bites 架站

至樹莓派網站下載 rpi-imager.exe 安裝RaspberryPi Lite 32bites

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python shared-mime-info

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.994_all.deb

dpkg --install webmin_1.994_all.deb

https://192.168.0.142:10000

-------------------------------------------

apt-get  install apache2

apt install php php-mbstring

<?php phpinfo(); ?>

apt-get install mariadb-server

apt install phpmyadmin

它現在會要求您為 PHPMyAdmin 本身設置密碼。最好將此密碼設置為與根 SQL 密碼不同的密碼。這樣做將有助於保護伺服器。

此密碼是PHPMyAdmin將用於連接到MySQL伺服器的密碼。

隨著 PHPMyAdmin 安裝過程的完成,我們需要做的最後一件事。 預設情況下,PHPMyAdmin 將阻止您使用“root”用戶登錄 PHPMyAdmin 介面。

相反,如果您希望在 PHPMyAdmin 中創建和訪問數據表,則需要創建一個新使用者。為此,我們需要首先使用具有您設置的密碼的“root”用戶登錄到MySQL命令行介面。

現在運行以下命令以創建一個用戶並允許它訪問 MySQL 伺服器上的所有資料庫。請記住您在此處輸入的詳細資訊,因為您將使用這些詳細資訊登錄 PHPMyAdmin

sudo mysql -u root -p

GRANT ALL PRIVILEGES ON *.* TO '使用者'@'localhost' IDENTIFIED BY '密碼' WITH GRANT OPTION;

使用者:學縮寫 密碼:通用

http://127.0.0.1/phpmyadmin

----------------------------- 

啟動使用者家目錄及PHP功能

1.a2enmod userdir

2.vi /etc/apache2/mods-enabled/userdir.conf

3. 設定AllowOverride All(記得把 Options 後面的 Indexes 刪除)

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride All
                Options MultiViews IncludesNoExec FollowSymLinks
                Require method GET POST OPTIONS
        </Directory>
</IfModule>

4. 編輯使用者PHP設定檔

##for Debian 10 Buster
vi /etc/apache2/mods-available/php7.3.conf
#for Debian 9 Stretch
vi /etc/apache2/mods-available/php7.0.conf
#for Debian 8 Jessie
vi /etc/apache2/mods-available/php5.conf

5.啟用PHP(註解掉最下面5行)

<FilesMatch ".+\.ph(ar|p|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(ar|p|ps|tml)$">
    Require all denied
</FilesMatch>

# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
#    <Directory /home/*/public_html>
#        php_admin_flag engine Off
#    </Directory>
##</IfModule>


6. service apache2 restart

--------------------------------------------------

將SSD格式化為NTFS,接入Pi的USB

#blkid 查詢

/dev/sda1: LABEL="PHPbb" BLOCK_SIZE="512" UUID="AC415A11BD97CFFA" TYPE="ntfs" PARTUUID="dcee6ba4-01"

#pico /etc/fstab. 掛載後重開機

PARTUUID=dcee6ba4-01    /home/    NTFS    defaults    0    1



沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。