萤火小程序商城系统前端、后端部署

系统:centos 7.4
环境:LNMP Nginx 1.8.1 PHP 7.17 Mysql 5.7.21 微信开发者工具
微信小程序ID 安全密钥自行申请
公共服务器一台,公网IP,域名(必须备案)、SSL证书 自行申请。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
yum install git -y
cd /usr/local/src
git clone https://gitee.com/xany/bestshop-php.git

mkdir -p /www && cd /www
cp -a /usr/local/src/bestshop-php .
git clone https://gitee.com/xany/yoshop_wechat.git (前端放在windows系统上)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
一、后端部署:
1.1、创建数据库、授权、导入数据:
create database yoshop charset=utf8;
grant all on yoshop.* to yo@'127.0.0.1' identified by 'yo.com531';
flush privileges;
use yoshop;
source /www/bestshop-php/doc/database/install.sql
quit
修改PHP连接数据库文件:
vim /www/bestshop-php/source/application/database.php


1.2、修改nginx 配置文件:
cd /usr/local/nginx/conf/vhost
vim yoshop.conf
server {
  listen 443 ssl;
  server_name weixin.xchinagroup.top;
  root /www/bestshop-php/web;
  ssl_certificate /usr/local/nginx/cert/weixin.xchinagroup.top.pem;
  ssl_certificate_key /usr/local/nginx/cert/weixin.xchinagroup.top.key;
  index index.php index.html index.htm;
  location ~* \.php* {
  set $script $uri;
  set $path_info "";
if ($uri ~ "^(.+.php)(/.+)") {
  set $script $1;
  set $path_info $2;
}
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$script;
  fastcgi_param SCRIPT_NAME $script;
  fastcgi_param PATH_INFO $path_info;
  try_files $uri =404;
  include fastcgi_params;
  include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
  expires 100d;
}
location ~ .*\.(js|css)?$ {
  expires 30d;
}
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
  root html;
}
}
#域名必须真实有效
保存退出,重启nginx
systemctl restart nginx
修改网站所有者:
cd /www/ bestshop-php
chown -R nginx. ./*
1.3、测试,登录网站:https://weixin.xchinagroup.top




二、++++++++++++++++++++++++ 前端部署

打开 





微信开发者工具,前端,设置可以参考http://www.xchinagroup.top/?p=2132







三、后端配置,添加商品3.1、设置小程序








3.2、添加商品分类:






同样的方法,添加其他类的商品



3.3、添加商品

先添加运费模版











同样方法添加其他商品



+++++++++++++++++++++
前端重新编译:




真机调试

扫码登录:



测试购买端口:



 





最后购买的时候和付款的时候会有一个报错,是因为没有在小程序后端把微信商户号添加进去。微信商户号在微信公众平台上可以申请,不过提交的资料非常多。