部署文档(centos7.x ginxmysql5.6jdk1.8ssljboot)

Posted coffee_cn

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署文档(centos7.x ginxmysql5.6jdk1.8ssljboot)相关的知识,希望对你有一定的参考价值。

部署文档(centos7.x ginxmysql5.6jdk1.8ssljboot)

1.基础环境
*********************************************************************
1.1检查安装semanage
yum -y install policycoreutils-python

1.2查看开放端口
firewall-cmd --state
firewall-cmd --zone=public --list-ports

1.3添加80和443端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --zone=public --add-port=8282/tcp --permanent
firewall-cmd --reload

1.4检查安装wget
yum -y install wget

1.5检查安装netstat
yum -y install net-tools

1.6建立目录结构
mkdir /xxxdata
mkdir -p /xxxdata/mysql/data
mkdir -p /xxxdata/website/xyz.mysite.com
mkdir -p /xxxdata/java
mkdir -p /xxxdata/temp

2.安装nginx
*********************************************************************
2.1添加源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.2安装Nginx
yum -y install nginx

2.3启动Nginx并设置开机运行
systemctl start nginx.service
systemctl enable nginx.service

2.4检查nginx
ps -ef | grep nginx
netstat -an | grep 80
http://192.168.168.37/


3.安装mysql5.6
*********************************************************************
3.1添加源
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

3.2安装mysql
yum -y install mysql-community-server

3.3修改datadir
vi /etc/my.cnf
datadir=/xxxdata/mysql
chown mysql:mysql /xxxdata/mysql
semanage fcontext -a -t mysqld_db_t "/xxxdata/mysql(/.*)?"
restorecon -Rv /xxxdata/mysql

3.3启动mysql并设置开机运行
systemctl start mysqld
systemctl enable mysqld

3.4重置密码(ROOT$$1234)
mysql_secure_installation
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y

3.5检查mysql
mysql -uroot -p

3.6建立数据库
create database xyz;

3.7建立数据库访问账号(xyz)和密码(xyz$$K2)
grant all privileges on xyz.* to [email protected]‘localhost‘ identified by ‘xyz$$K2‘;
flush privileges;

3.8检查数据库账号xyz
mysql -uxyz -p

3.9导入项目SQL
mysql -uxyz -p xyz < xyz.sql

4.安装jdk1.8
*********************************************************************
4.1上传或下载tar包
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
jdk-8u192-linux-x64.tar.gz

4.2解压缩至目录/xxxdata/java
tar -zxvf jdk-8u192-linux-x64.tar.gz

4.3配置环境
vi /etc/profile
export JAVA_HOME=/xxxdata/java/jdk1.8.0_192
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
. /etc/profile

4.4检查java
java -version

5.部署jboot项目
5.1上传项目文件
/xxxdata/website/xyz.mysite.com

5.2运行项目
cd /xxxdata/website/xyz.mysite.com/app/bin
chmod +x jboot.sh
./jboot.sh

5.2检查项目
http://192.168.168.37:8282/admin

6.配置nginx
*********************************************************************
6.1上传证书文件xyz.mysite.com.pem和xyz.mysite.com.key
/etc/ssl/xyz.mysite.com.pem
/etc/ssl/xyz.mysite.com.key

openssl x509 -in xyz.mysite.com.crt -out xyz.mysite.com.pem
openssl x509 -in xyz.mysite.com.pem -out xyz.mysite.com.crt

6.2修改nginx.conf文件
vi /etc/nginx/nginx.conf

upstream xyz_server {
server 127.0.0.1:8282 weight=100;
}

6.3上传站点配置文件ssl.xyz.mysite.com.conf和xyz.mysite.com.conf文件
/etc/nginx/conf.d/ssl.xyz.mysite.com.conf
/etc/nginx/conf.d/xyz.mysite.com.conf

6.4解决错误connect() to 127.0.0.1:8282 failed (13: Permission denied) while connecting to upstream
setsebool -P httpd_can_network_connect 1

6.4重启nginx

6.5检查配置
http://xyz.mysite.com/admin

7.关闭端口只开放443端口
firewall-cmd --zone=public --remove-port=8282/tcp --permanent
firewall-cmd --zone=public --remove-port=80/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-ports

9.重启机器
*********************************************************************
9.1检查mysql是否开启启动
9.2检查nginx是否开机启动
9.3访问测试
https://xyz.mysite.com/admin

 

以上是关于部署文档(centos7.x ginxmysql5.6jdk1.8ssljboot)的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7.X环境下源码包安装部署RabbitMQ3.7.17

CentOS7.X 部署OpenVPN

Centos7.x部署SeaFile私有网盘

CentOS7.X系统安装部署Consul1.4.2

CentOS7.X安装部署mysql5.7主从环境

python系列centos7.x中部署多个python版本