0:去阿里云購買一臺ECS铺遂,選擇系統(tǒng)為CentOS 7.2 x64版本
1:配置SSH登陸服務器
【本地】 - 生成KEY(略):ssh-keygen -t rsa -C "${email}"
【本地】 - 上傳公鑰:scp id_rsa.pub ${username}@${ip_address}:~/
【ECS】 - 添加SSH:cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
【ECS】 - 刪除KEY:rm ~/id_rsa.pub
2:下載OpenResty的最新壓縮包
中文官網:https://openresty.org/cn/download.html
下載最新版的壓縮包到本地必盖,通過scp傳到服務器上
(略)yum update
yum -y install openssl openssl-devel ? ? ? ? ? ? ? ? ? ? ? // 安裝依賴
根據指示構建:https://openresty.org/cn/installation.html
啟動Nginx:
(PS:因為我的OpenResty安裝在/usr/local/openresty目錄下)
/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf -p /usr/local/openresty/nginx/
后面加上-s reload則是重新加載nginx配置文件
這個時候網站應該已經可以訪問了
3:安裝PHP7.1
添加rpm源:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安裝PHP7.1
yum -y install php71w-fpm php71w-cli php71w-gd php71w-mcrypt php71w-mysql php71w-pear php71w-xml php71w-mbstring php71w-pdo php71w-json php71w-pecl-apcu php71w-pecl-apcu-devel
執(zhí)行php -v 或php-fpm -v 已經可以看到輸出
安裝composer
官網:https://getcomposer.org/download/
安裝完成后盏求,在當前目錄執(zhí)行:
sudo mv composer.phar /usr/local/bin/composer
4:安裝Redis
https://redis.io/download#installation
5:安裝Node.js
安裝Node.js版本控制工具NVM:https://github.com/creationix/nvm#installation
查看當前LTS版本:
nvm list-remote
選擇LTS版本安裝
nvm install v{$version}
現在執(zhí)行node -v已經可以看到輸出
6:安裝MySQL
查看官方源:https://dev.mysql.com/downloads/repo/yum/
選擇Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package下的鏈接赫悄,如:mysql57-community-release-el7-11.noarch.rpm
然后下載源安裝包:
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安裝mysql源:
yum localinstall mysql57-community-release-el7-11.noarch.rpm
安裝mysql:
yum install mysql-community-server
啟動mysql:
systemctl start mysqld
可通過輸入:systemctl status mysqld 檢查mysql運行狀態(tài)
獲取默認密碼:
grep temporary password /var/log/mysqld.log
使用默認密碼登錄后袄简,更改密碼:
mysql-uroot-p
set password for'root'@'localhost'=password('newPassword!');?
(新密碼的強度需要很高歹鱼,這個是由mysql的配置文件決定的酪刀,可以自行百度修改)