时间:2023-07-30 17:15:02 | 来源:网站运营
时间:2023-07-30 17:15:02 来源:网站运营
原来搭建淘客项目如此简单,app、web、小程序轻松搞定:本篇文章主要是记录Coupons项目在Linux环境下的安装过程yum search openjdk
yum -y install java-1.8.0-openjdk.x86_64
验证是否安装成功java -version
输入如下内容表示安装成功openjdk version "1.8.0_302"OpenJDK Runtime Environment (build 1.8.0_302-b08)OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)
wget https://codeload.github.com/silently9527/coupons/zip/refs/heads/masterunzip coupons-master.zip
mysql --port=3309 -uroot -p
create database mall-coupons default character set utf8mb4 collate utf8mb4_unicode_ci;
use mall-coupons;source /Users/xxx/Downloads/coupons-master/doc/scheme.sql
source命令后面的文件路径替换成你自己的路径;
cd coupons-master/server/src/main/resources
application-prod.properties
,修改文件中的必要参数#填写前面淘客注册应用的 AppKey、AppSecretdataoke.appKey=dataoke.appSecret=#填写前面注册QQ小程序的appId、appSecretspring.social.qq.app-id=spring.social.qq.app-secret=#填写前面注册微信小程序的appId、appSecretspring.social.wechat.app-id=spring.social.wechat.app-secret=# 配置MySQL数据库的地址spring.datasource.url=jdbc:mysql://localhost:3306/mall-coupons?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=Asia/Shanghaispring.datasource.username=rootspring.datasource.password=xxx# 配置Redis服务器地址spring.redis.host=spring.redis.password=spring.redis.port=# mob短信服务的appkey,需要打包收集app的才需要mob.service.appkey=
mvn clean package -DskipTests
当出现了Build Success的时候就表示打包完成target
目录,cd target
进入到目录,查看是否有生成文件mall-coupons-server-0.0.1-SNAPSHOT.jar
mall-coupons-server-0.0.1-SNAPSHOT.jar
java -Djava.security.egd=file:/dev/./urandom -jar mall-coupons-server-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod > ./mall-coupons-server.log &
/etc/nginx/conf.d
,创建配置文件coupon.conf
cd /etc/nginx/conf.dtouch coupon.conf
coupon.conf
,输入如下内容:upstream coupons-services { server localhost:9090 weight=10;}server { listen 80; server_name 你的域名; include /etc/nginx/default.d/*.conf; location / { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-auth-token'; if ($request_method = 'OPTIONS') { return 204; } proxy_pass http://coupons-services/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10000m; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { }}
systemctl restart nginx
coupons-master/client
导入前端代码到HBuilder中,如何使用HBuilder导入项目、打包可以参考官方文档 https://uniapp.dcloud.io/quickstart-hxpages/public/login.vue
中92行配置短信模板的id,这里的模版id需要在短信平台mob上面申请client/config.js
输入自己服务器的域名地址module.exports = { // APIHOST: "http://localhost:9090"}
关键词:程序,简单,项目