Web服务器安装全记录(VPS+Linux+WebServer+WebAdmin+WebApp)
目录:
- VPS虚拟专用服务器购买及配置
- Linux操作系统安装
- Web服务程序安装
- Web管理程序安装
- Web应用程序安装
名词解释:
- VPS: 虚拟专用服务器
- Linux: Linux操作系统安装
- 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操作系统安装
1.1 Raspberry Pi Desktop
1)安装
2)仓库镜像修改
Debian 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用 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)