基于nginx+tomcat部署商城系统并连接数据库

需三台服务器
nginx 192.168.200.111
tomcat 192.168.200.112
tomcat 192.168.200.113

192.168.200.111
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# iptables -F
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
32 upstream tomcat_server {
33 ip_hash;
34 server 192.168.200.112:8080 weight=1;
35 server 192.168.200.113:8080 weight=1;
36 }
47 location / {
48 root html;
49 index index.html index.htm;
50 proxy_pass http://tomcat_server;
51 proxy_set_header Host $http_host;
52 }
[root@localhost ~]# killall -1 nginx
[root@localhost ~]# yum -y install mariadb mariadb-server
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# mysql
MariaDB [(none)]> grant all on slsaledb.* to admin@'%' identified by '123456';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
[root@localhost ~]# mysql -uroot < slsaledb-2014-4-10.sql
[root@localhost ~]# systemctl restart mariadb

tomcat 192.168.200.112 / tomcat 192.168.200.113

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# iptables -F
[root@localhost ~]# mkdir /web/webapp -pv
[root@localhost ~]# tar fx SLSaleSystem.tar.gz -C /web/webapp
[root@localhost ~]# vim /usr/local/tomcat8/conf/server.xml
150 <Context docBase="/web/webapp/SLSaleSystem" path="" reloadable="flase"></Context>
[root@localhost ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties
driverClassName=com.mysql.jdbc.Driver
url=jdbc\:mysql\://192.168.200.111\:3306/slsaledb?useUnicode\=true&characterEncoding\=UTF-8
uname=admin
password=123456
minIdle=10
maxIdle=50
initialSize=5
maxActive=100
maxWait=100
removeAbandonedTimeout=180
removeAbandoned=true
[root@localhost ~]# /usr/local/tomcat8/bin/shutdown.sh
[root@localhost ~]# /usr/local/tomcat8/bin/startup.sh

 

posted @ 2019-10-09 14:50  有无  阅读(348)  评论(1编辑  收藏  举报

博客记录了我学习linux过程中的一些问题及解决方法,内容可能仅适用于个人,如带来不便,望请见谅!