在等待域名备案的这20天中,我们首先要做的就是配置我们的云服务器,最主要的是LNMP环境的安装与配置。
cp /etc/apt/sources.list /etc/apt/sources.list.bak vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
apt-get update
adduser www usermod -aG sudo www
#禁止root用户连接 PermitRootLogin No ssh自动断开连接配置# ClientAliveInterval 60 ClientAliveCountMax 3
# nginx web 服务器安装 apt-get install nginx # mariadb mysql 服务器安装 apt-get install mariadb-server # php7.3 查找、安装 apt-get install software-properties-common add-apt-repository ppa:ondrej/php apt-cache search php7.3 apt-get install php7.3 php7.3-common php7.3-fpm php7.3-pdo php7.3-opcache php7.3-mysql php7.3-gd php7.3-mbstring php7.3-dom php7.3-curl php7.3-zip # redis nosql服务器安装 add-apt-repository ppa:chris-lea/redis-server -y apt-get install redis-server # beanstalked 消息队列安装 apt-get install libevent-dev add-apt-repository ppa:jernej/beanstalkd -y apt-get install beanstalked # 其他软件安装 apt-get install git unzip zip vim tree
#编辑 /etc/rc.local 文件,加入如下内容 service redis-server restart service beanstalkd restart
ufw
命令配置防火墙
#开启防火墙 sudo ufw enable #默认禁止全部端口 sudo ufw default deny #开启ssh端口 sudo ufw allow 22/tcp #开启web服务端口 8080端口备案前临时开启 sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw allow 8080/tcp #查看防火墙状态 sudo ufw status