部署文檔(centos7.x ginxmysql5.6jdk1.8ssljboot)
部署文檔(centos7.x\nginx\mysql5.6\jdk1.8\ssl\jboot)
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=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
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 xyz@‘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\nginx\mysql5.6\jdk1.8\ssl\jboot)