[ECS]迁移站点到Https完成

2018-03-06 周二

申请ECS,创建服务环境
1、SSH密钥远程登录
IP:xxxx
PEM文件: xxxx.pem

登录成功后查看服务器配置:
[root@************** ~]# hostnamectl
Static hostname: **************
Pretty hostname: **************
Transient hostname: **************
Icon name: computer-vm
Chassis: vm
Machine ID: **************
Boot ID: **************
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.2.2.el7.x86_64
Architecture: x86-64

查看语言、时区信息:
[root@************** ~]# localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: n/a
[root@iZ2ze1tbcm44nz84tv8i63Z ~]# timedatectl
Local time: 五 2018-03-09 10:07:15 CST
Universal time: 五 2018-03-09 02:07:15 UTC
RTC time: 五 2018-03-09 10:07:14
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: yes
DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
This mode can not be fully supported. It will create various problems
with time zone changes and daylight saving time adjustments. The RTC
time is never updated, it relies on external facilities to maintain it.
If at all possible, use RTC in UTC by calling
‘timedatectl set-local-rtc 0’.

2、创建LNMP环境
(参考文章:http://www.nginx.cn/install)
安装make:
yum -y install gcc automake autoconf libtool make
安装g++:
yum install gcc gcc-c++
一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。
1.选定源码目录
可以是任何目录,本文选定的是/usr/local/src
2.安装PCRE库
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:

cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
tar -zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure
make
make install

3.安装zlib库
http://zlib.net/zlib-1.2.11.tar.gz 下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:

5.安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:

cd /usr/local/src
wget http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
cd nginx-1.12.2
 
./configure –sbin-path=/usr/local/nginx/nginx \
–conf-path=/usr/local/nginx/nginx.conf \
–pid-path=/usr/local/nginx/nginx.pid \
–with-http_ssl_module \
–with-pcre=../pcre-8.41 \
–with-zlib=../zlib-1.2.11 \
–with-openssl=../openssl-1.0.2n
 
make
make install

注解:http://nginx.org/en/docs/configure.html

The OpenSSL library is required to build and run this module.
这里所谓的Library,就是需要依赖库的源码,在上面加上”–with-openssl=../openssl-1.0.2n”

==============================================================================

Nginx 配置
创建 Nginx 运行使用的用户 stucture:
创建用户组 /usr/sbin/groupadd www
创建用户加入该组 /usr/sbin/useradd -g www www

配置nginx.conf ,将/usr/local/webserver/nginx/conf/nginx.conf替换为以下内容
参考:http://www.runoob.com/linux/nginx-install-setup.html

How to install and run WordPress with MariaDB
https://mariadb.com/resources/blog/how-install-and-run-wordpress-mariadb
安装参考:
https://segmentfault.com/a/1190000007896580

Install MariaDB 10.2 on Fedora 27/26, CentOS/RHEL 7.4/6.9


systemctl start mariadb //启动MariaDB
systemctl stop mariadb //停止MariaDB
systemctl restart mariadb //重启MariaDB
systemctl enable mariadb //设置开机启动
设置root账户密码:
mysql_secure_installation

root password: *********

设置root密码后,重启mariadb生效
systemctl restart mariadb.service

测试访问数据库:
mysql -uroot -p

然后输入密码,登录成功后显示如下:
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
MariaDB [(none)]>

输入如下命令,查看数据库服务器的数据库
show databases;

退出命令
exit;

三、安装php以及php扩展
http://blog.csdn.net/wufei1314a/article/details/52299967
yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash

./configure \
–prefix=/usr/local/php7 \
–exec-prefix=/usr/local/php7 \
–bindir=/usr/local/php7/bin \
–sbindir=/usr/local/php7/sbin \
–includedir=/usr/local/php7/include \
–libdir=/usr/local/php7/lib/php \
–mandir=/usr/local/php7/php/man \
–with-config-file-path=/usr/local/php7/etc \
–with-mysql-sock=/var/run/mysql/mysql.sock \
–with-mcrypt=/usr/include \
–with-mhash \
–with-openssl \
–with-mysql=shared,mysqlnd \
–with-mysqli=shared,mysqlnd \
–with-pdo-mysql=shared,mysqlnd \
–with-gd \
–with-iconv \
–with-zlib \
–enable-zip \
–enable-inline-optimization \
–disable-debug \
–disable-rpath \
–enable-shared \
–enable-xml \
–enable-bcmath \
–enable-shmop \
–enable-sysvsem \
–enable-mbregex \
–enable-mbstring \
–enable-ftp \
–enable-gd-native-ttf \
–enable-pcntl \
–enable-sockets \
–with-xmlrpc \
–enable-soap \
–without-pear \
–with-gettext \
–enable-session \
–with-curl \
–with-jpeg-dir \
–with-freetype-dir \
–enable-opcache \
–enable-fpm \
–enable-fastcgi \
–with-fpm-user=stucture \
–with-fpm-group=www \
–without-gdbm \
–disable-fileinfo

2018新年第一天上班

计划要完成的一些事情:
1、配置自己的科学上网服务器✔️
2、微信小程序(需要备案的云服务器支持)
3、完善自动申请进京证的Server
4、WordPress迁移?✔️(3月29日)
5、选购ECS?✔️(3月6日)
6、Python后台服务器

2018年3月29日 周四 更新:
完成4、5,接下来做3、6,并完成2