参与网址https://developer.aliyun.com/topic/ecs2022
选择网址可获得一个月的体验机会
配置如上图选择立即购买,下一步即可,购买完毕后等待三分钟修改密码,先进入esc工作台,选择实例
修改完密码后等待重启,重启成功可以选择上面的远程连接,用户名root密码就是刚才重置后的密码
因为有公网ip,如果本地下载了xshell7也可以通过本地连接
首先选择一下安全组,防止一会ping外网搞不定,导致除服务器局域网内的其他服务器都无法连接
如果有上传和下载都要把安全组设置一下
这样我们就有了属于自己的一台云服务器,下一步就是了解lnmp部署和wordpress了
9 yum install -y libaio perl-Data-Dumper autoconf
10 groupadd -r mysql
11 useradd -r -g mysql -d /data/mysql mysql
12 mkdir -p /data/mysql
13 chown -R mysql.mysql /data/mysql
14 wget
http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz
15 ll
16 tar xvf mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz -C /usr/local
17 cd /usr/local
18 ln -sv mysql-5.6.51-linux-glibc2.12-x86_64/ mysql
19 chown -R mysql.mysql /usr/local/mysql/
20 cd mysql
21 ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql/
22 ll /data/mysql/
23 cat > /etc/my.cnf <
[mysqld]
user=mysql
datadir=/data/mysql
socket=/data/mysql/mysql.sock
innodb_file_per_table=on
skip_name_resolve = on
[client]
port=3306
socket=/data/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/data/mysql/mysql.pid
EOF
24 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
25 chkconfig --add mysqld && chkconfig mysqld on
26 service mysqld start
27 echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
28 . /etc/profile.d/mysql.sh
29 mysql -uroot -p
30 cd ~
31 yum -y install gcc libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel oniguruma-devel openssl-devel
将下载下来的安装包放到home目录下
安装php
35 tar xf php-7.4.27.tar.gz
36 cd php-7.4.27/
37 ./configure --prefix=/apps/php --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-zlib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-mbstring --enable-xml --enable-sockets --enable-fpm --enable-maintainer-zts --disable-fileinfo
38 make -j 4 && make install
52 echo 'PATH=/apps/php/bin:/apps/httpd/bin:$PATH' > /etc/profile.d/php.sh
53 . /etc/profile.d/php.sh
54 cp php.ini-production /etc/php.ini
55 cd /apps/php/etc && cp php-fpm.conf.default php-fpm.conf
56 cd php-fpm.d/ && cp www.conf.default www.conf
57 vim www.conf
[www]
user
= www
group
= www
listen
=
127.0
.
0.1
:
9000
pm
= dynamic
pm.max_children
=
5
pm.start_servers
=
2
pm.min_spare_servers
=
1
pm.max_spare_servers
=
3
pm.status_path
= /pm_status
ping.path
= /ping
access.log
= log/
$pool
.access.log
slowlog
= log/
$pool
.log.slow
58 useradd -r -s /sbin/nologin www
59 mkdir /apps/php/log
60 /apps/php/sbin/php-fpm -t
61 cp php-7.4.27/sapi/fpm/php-fpm.service /usr/lib/systemd/system/
62 cd ~
63 cp php-7.4.27/sapi/fpm/php-fpm.service /usr/lib/systemd/system/
64 systemctl daemon-reload && systemctl enable --now php-fpm
65 ss -ntl
安装Nginx
66 wget -O /usr/local/src/nginx-1.18.0.tar.gz
http://nginx.org/download/nginx-1.18.0.tar.gz
67 cd /usr/local/src/
68 tar xvf nginx-1.18.0.tar.gz
69 cd ~
70 yum -y install gcc pcre-devel openssl-devel zlib-devel
71 useradd -s /sbin/nologin nginx
72 cd nginx-1.18.0
73 cd /usr/local/src/
74 cd nginx-1.18.0
75 ./configure --prefix=/apps/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
76 make -j 4 && make install
77 chown -R nginx.nginx /apps/nginx
78 ll /apps/nginx/
79 vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http:
//nginx
.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking PIDFile=
/apps/nginx
/run/nginx
.pid
ExecStart=
/apps/nginx
/sbin/nginx
-c /apps/nginx/conf/nginx.conf
ExecReload=
/bin/
kill
-s HUP $MAINPID
ExecStop=
/bin/
kill
-s TERM $MAINPID
[Install]
WantedBy=multi-user.target
80 mkdir /apps/nginx/run/
81 vim /apps/nginx/conf/nginx.conf
http {
include
/apps/nginx/conf.d/*.conf;
#在http语句块添加此行
}
82 ln -s /apps/nginx/sbin/nginx /usr/sbin/
83 nginx -v
后续的会涉及到网站备案,先写到这吧,需要留言