GaoLi's Blog

阿里云服务器部署

添加三方源

EPEL

1
2
3
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
yum repolist

remi

1
2
3
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
yum repolist

Git

安装

1
yum --enablerepo=remi install git

创建 SSH key

1
ssh-keygen -t rsa -b 4096 -C "3071730@qq.com"

配置 name 与 email

1
2
git config --global user.name "gaoli"
git config --global user.email "3071730@qq.com"

Node

安装 NVM

1
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash

安装 Node

1
nvm install v6.7.0

安装 cnpm

1
npm install -g cnpm --registry=https://registry.npm.taobao.org

安装 PM2

1
cnpm install pm2 -g

Nginx

安装

1
yum --enablerepo=remi install nginx

配置

1
vi /etc/nginx/nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
location / {
proxy_pass http://127.0.0.1:3000;
}
location /phpmyadmin {
alias /usr/share/nginx/phpMyAdmin/;
index index.php;
}
location ~ /phpmyadmin/.+\.php$ {
if ($fastcgi_script_name ~ /phpmyadmin/(.+\.php.*)$) {
set $valid_fastcgi_script_name $1;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/phpMyAdmin/$valid_fastcgi_script_name;
include fastcgi_params;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

启动

1
2
systemctl start nginx
systemctl enable nginx.service

PHP

安装

1
2
yum --enablerepo=remi install php php-fpm
yum --enablerepo=remi install php-gd php-mysql php-mbstring php-xml php-mcrypt

启动

1
2
systemctl start php-fpm
systemctl enable php-fpm.service

MySQL

安装

1
yum --enablerepo=remi install mysql mysql-devel
1
2
3
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

启动

1
2
systemctl start mysqld
systemctl enable mysqld.service

设置密码

1
2
mysql -u root
set password for 'root'@'localhost' =password('password');

设置编码

1
vi /etc/my.cnf
1
2
[mysql]
default-character-set=utf8

设置远程连接

1
grant all privileges on *.* to root@'%'identified by 'password';

phpMyAdmin

安装

1
2
wget http://files.phpmyadmin.net/phpMyAdmin/4.4.15.8/phpMyAdmin-4.4.15.8-all-languages.tar.gz
tar -xzvf phpMyAdmin-4.4.15.8-all-languages.tar.gz

生成短语密码

1
2
3
openssl rand -base64 32
// KHXwxJgVfzsy+3yii07RFOk89i2VRX8XfkCyqRNfyFY

配置

1
cp config.sample.inc.php config.inc.php
1
$cfg['blowfish_secret'] = 'KHXwxJgVfzsy+3yii07RFOk89i2VRX8XfkCyqRNfyFY'