应用服务器基础环境快速搭建
安装命令
yum install -y lrzsz*
安装mysql
更新系统软件包
sudo yum update -y
安装MySQL数据库
sudo yum install mysql-server -y
启动MySQL服务
sudo systemctl start mysqld
设置MySQL服务开机自启动
sudo systemctl enable mysqld
设置MySQL管理员账号
sudo mysqladmin -u root password agree88888888
登录MySQL数据库
mysql -u root -p
创建数据库
CREATE DATABASE atcoin
使用数据库
USE atcoin
配置远程连接数据库
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> update user set host = '%' where user = "root";
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
导入数据库
source output.sql
安装java
解压tar包
[atcoin@iZf8z2qki98kfvb8k3iy3aZ ~]$ tar -zxvf jdk-8u401-linux-x64.tar.gz
配置环境变量
[atcoin@iZf8z2qki98kfvb8k3iy3aZ ~]$ vi .bash_profile
# JAVA_HOME
export JAVA_HOME=/home/atcoin/jdk1.8.0_401
export PATH=$PATH:$JAVA_HOME/bin
环境变量生效并应用
[atcoin@iZf8z2qki98kfvb8k3iy3aZ ~]$ source .bash_profile
[atcoin@iZf8z2qki98kfvb8k3iy3aZ ~]$ java -version
java version "1.8.0_401"
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)
安装redis
解压安装包
tar -zxvf redis-7.2.4.tar.gz
执行编译
cd redis-7.2.4/
make
后台启动服务
src/redis-server &
安装nginx
yum install nginx
修改/etc/nginx/nginx.conf
user root;
worker_processes 1;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;server {listen 81;server_name 47.115.202.222;charset utf-8;location / {root /home/atcoin/dist;try_files $uri $uri/ /index.html;index index.html index.htm;}location /prod-api/ {proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://47.115.202.222:8081/;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}}
}
user root; 启动用户和使用用户不一致,则会一直报500
nginx 命令
## 启动
nginx
## 停止
nginx -s stop
## 重载
nginx -s reload