原创

某微信公帐号H5商城前后端部署

一、开发环境

相关工具:IDEA IDE工具、JDK1.8、MySQL、Maven、Nginx

<groupId>net.wanghaifeng</groupId>
<artifactId>weixinsell</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>weixinsell</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>


二、编译打包,端口为8089

G:\workstation\12_Project\project-idea\weixinsell>mvn clean package -DskipTests
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for net.wanghaifeng:weixinsell:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.projectlombok:lombok:jar -> duplicate declaration of version 1.16.16 @ line 53, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.boot:spring-boot-starter-freemarker:jar -> duplicate declaration of version (?) @ line 113, column 21
[WARNING]
........................省略......................................

三、拷贝生成的jar包上传到服务器



四、启动Java服务

可以采用两种方式:

1、通过java -jar 命令启动

root@wanghf:/javajar# java -jar weixinsell-0.0.1-SNAPSHOT.jar

2、通过noup启动在后台启动,如下所示:

root@wanghf:/javajar# nohup java -server -Xms256m -Xmx512m -jar weixinsell-0.0.1-SNAPSHOT.jar > nohup.out 2>&1 &

[1] 12197
root@wanghf:/javajar# lsof -i:8089
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 12197 root 31u IPv4 38379266 0t0 TCP *:8089 (LISTEN)

五、部署前端

1、部署好nginx后,启动nginx服务

2、添加vhost配置,如下图所示:


3、启动nginx服务

root@wanghf:/usr/local/nginx/conf/vhost# service nginx restart
* Stopping Nginx Server... [ OK ]
* Starting Nginx Server... 

查看前端H5是否可以打开,如下图所示,如果可以打开,说明已经部署成功
正文到此结束
本文目录