Web服務器安裝全記錄(VPS+Linux+WebServer+WebAdmin+WebApp)
目錄:
- VPS虛擬專用服務器購買及配置
- Linux操作系統(tǒng)安裝
- Web服務程序安裝
- Web管理程序安裝
- Web應用程序安裝
名詞解釋:
- VPS: 虛擬專用服務器
- Linux: Linux操作系統(tǒng)安裝
- WebServer: Web服務(含Apach/Nginx, MySQL/MariaDB, PHP)
- WebAdmin: Web服務管理面板(例如寶塔面板等)
- WebAPP: Web應用程序(例如WordPress等)
1 VPS虛擬專用服務器購買及配置
1.1 Vultr
1)購買服務器
Vultr VPS 2.5刀的套餐免費擁有IPV4的bug方法 – VPS攻略 (vpsgongyi.net)
2022-07-26 Vultr:
Address: 139.180.131.130 Netmask: 255.255.254.0 Gateway: 139.180.130.1 Reverse DNS: 139.180.131.130.vultrusercontent.com Address: 2001:19f0:4400:6300:5400:04ff:fe15:20e5 Network: 2001:19f0:4400:6300:: Netmask: 64 Recursive DNS: 2001:19f0:300:1704::6
2 Linux操作系統(tǒng)安裝
1.1 Raspberry Pi Desktop
1)安裝
2)倉庫鏡像修改
Debian 的軟件源配置文件是 /etc/apt/sources.list。將系統(tǒng)自帶的該文件做個備份再悼,將該文件替換為下面內容凝垛,即可使用 NJU軟件源鏡像。
請根據 Debian/Ubuntu 版本自行替換{{release_name}}
- stretch/buster
- bullseye/testing
deb https://mirror.nju.edu.cn/debian/ {{release_name}} main contrib non-free # deb-src https://mirror.nju.edu.cn/debian/ {{release_name}} main contrib non-free deb https://mirror.nju.edu.cn/debian/ {{release_name}}-updates main contrib non-free # deb-src https://mirror.nju.edu.cn/debian/ {{release_name}}-updates main contrib non-free deb https://mirror.nju.edu.cn/debian/ {{release_name}}-backports main contrib non-free # deb-src https://mirror.nju.edu.cn/debian/ {{release_name}}-backports main contrib non-free deb https://mirror.nju.edu.cn/debian-security {{release_name}}-security main contrib non-free # deb-src https://mirror.nju.edu.cn/debian-security {{release_name}}-security main contrib non-free
3)更新及設置
apt update
fdisk -l
df
reboot
∞)參考:
Raspberry Pi Desktop for PC and Mac – Raspberry Pi
Debian 幫助文檔 (nju.edu.cn)
1.2 Debian
1.3 Deepin
3 Web服務程序安裝(本章可跳過,直接按照第4章安裝Web管理程序)
3.1 安裝Apach / Nginx
3.2 安裝MySQL / MariaDB
3.3 安裝PHP
PHP: Debian GNU/Linux 安裝說明 - Manual
apt install php-mysqlReading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: gir1.2-packagekitglib-1.0 libappstream4 libdw1 libglib2.0-bin libgstreamer1.0-0 libpackagekit-glib2-18 libstemmer0d libunwind8 packagekit packagekit-tools python3-software-properties software-properties-common Use 'apt autoremove' to remove them. The following additional packages will be installed: php-common php7.4-common php7.4-mysql The following NEW packages will be installed: php-common php-mysql php7.4-common php7.4-mysql 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 1,167 kB of archives. After this operation, 8,127 kB of additional disk space will be used.
3.4 樹莓派安裝服務器
sudo apt-get update sudo apt-get install php-mysql sudo apt-get install samba sudo apt-get install samba-common-bin sudo vim /etc/samba/smb.conf sudo apt-get install vsftpd sudo service vsftpd start sudo vim /etc/vsftpd.conf
4 Web管理程序安裝
4.1 安裝OpenLiteSpeed
1)腳本一鍵安裝
輸入:
bash <( curl -k https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh ) -w
輸出:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 65793 100 65793 0 0 526k 0 --:--:-- --:--:-- --:--:-- 526k ********************************************************************************************** * Open LiteSpeed One click installation, Version 3.0 * * Copyright (C) 2016 - 2022 LiteSpeed Technologies, Inc. * ********************************************************************************************** Current platform is DEBIAN11 debian bullseye. Starting to install OpenLiteSpeed to /usr/local/lsws/ with the parameters below, WebAdmin password: WebAdmin email: root@localhost LSPHP version: 81 MariaDB version: 10.9 Install WordPress: Yes WordPress HTTP port: 80 WordPress HTTPS port: 443 WordPress language: en_US Web site domain: * MySQL root Password: Database name: olsdbname Database username: olsdbuser Database password: WordPress plus: No WordPress location: /usr/local/lsws/wordpress (New install) Your password will be written to file: /usr/local/lsws/password
2)關閉防火墻
ufw disable
∞)參考
OpenLiteSpeed
1-Click Install OLS, PHP, MySQL, WP and LSCache – OpenLiteSpeed
如何在Debian 10中使用ufw設置防火墻 - 知乎 (zhihu.com)