Uninote
Uninote
用户根目录
brdr
common
programming
docs
后端试题
问题讨论

服务器部署路径

  • nginx 配置:/usr/local/nginx/conf
  • 项目路径:/home/www

docker host 配置

注意,所有的服务是放在一个 docker 里面的,域名的配置在 host 的 nginx 里面:

[root@unihost vhost]# cat bb.dev.conf
access_log /home/wwwlogs/dev/all-access.log;
error_log /home/wwwlogs/dev/all-error.log;
# log
server {
    charset utf-8;
    client_max_body_size 128M;
    listen 80;
    server_name dev.log.bb.uninote.com.cn;
    location / {
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
	proxy_pass http://172.17.0.4:106;
    }
}
#log_format  main  'IP:$remote_addr || time:$time_local || request_time:$request_time || ur_time:$upstream_response_time || request:"$request" || status:$status || bytes_sent:$body_bytes_sent || UA:"$http_user_agent" || forward: "$http_x_forwarded_for"';
# api
server{
    listen 80;
    if ($scheme = http){
	return 301 https://$host$request_uri;
    }
    listen 443 ssl;
    server_name dev.api.bb.uninote.com.cn;

    ssl_trusted_certificate     /etc/letsencrypt/live/dev.api.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate             /etc/letsencrypt/live/dev.api.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/dev.api.bb.uninote.com.cn/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_stapling on;
    ssl_stapling_verify on;

    resolver 8.8.8.8 8.8.4.4 valid=600s;
    resolver_timeout 6s;

    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Headers *;
    add_header Access-Control-Allow-Methods 'GET,POST';
    add_header Access-Control-Allow-Headers 'token,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    location / {
        rewrite /api/(.*) /$1 break;
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
	proxy_pass http://172.17.0.4:100;
    }

#    location /h5 {
#        proxy_set_header Host      $host;
#        proxy_set_header X-Real-IP $remote_addr;
#        proxy_pass http://172.17.0.4:108;
#    }

}
# cms
server {
    listen 8282 ssl;
    listen 443 ssl;
    server_name dev.admin.bb.uninote.com.cn;
    listen 80;
    if ($scheme = http){
        rewrite 301 https://$host$request_uri;
    }
    ssl_trusted_certificate     /etc/letsencrypt/live/dev.admin.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate             /etc/letsencrypt/live/dev.admin.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/dev.admin.bb.uninote.com.cn/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    ssl_stapling on;
    ssl_stapling_verify on;

    resolver 8.8.8.8 8.8.4.4 valid=600s;
    resolver_timeout 6s;

    set $port 102;
    if ($server_port = 8282){
        set $port 8282;
    }

    location / {
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://172.17.0.4:$port;
    }
}

# shop
server {
    listen 443 ssl;
    listen 80;
    if ($scheme = http){
        return 301 https://$host$request_uri;
    }
    server_name dev.s.bb.uninote.com.cn;
    ssl_trusted_certificate     /etc/letsencrypt/live/dev.s.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate             /etc/letsencrypt/live/dev.s.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/dev.s.bb.uninote.com.cn/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    ssl_stapling on;
    ssl_stapling_verify on;

    resolver 8.8.8.8 8.8.4.4 valid=600s;
    resolver_timeout 6s;
    location / {
	if ($request_uri = "/shop-web"){return 301 https://$host/shop-web/;}
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://172.17.0.4:107;
    }
}

# workerman
server {
    listen 80;
    server_name dev.wm.bb.uninote.com.cn;
        location / {
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://172.17.0.4:8282;
    }
}

# H5版本
server {
    listen 443 ssl;
    listen 80;
    if ($scheme = http){
        return 301 https://$host$request_uri;
    }
    server_name dev.h5.bb.uninote.com.cn;
    ssl_trusted_certificate     /etc/letsencrypt/live/dev.h5.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate             /etc/letsencrypt/live/dev.h5.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/dev.h5.bb.uninote.com.cn/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    ssl_stapling on;
    ssl_stapling_verify on;

    resolver 8.8.8.8 8.8.4.4 valid=600s;
    resolver_timeout 6s;

    location / {
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://172.17.0.4:108;
    }

    location  /api {
        rewrite  ^/api/(.*)$ /$1 break;
        proxy_pass http://172.17.0.4:100;
        proxy_redirect default;
        proxy_set_header Host      $proxy_host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

# 大爱金孝APP-H5版本 cyb test
server {
    listen 443 ssl;
    listen 80;
    if ($scheme = http){
        return 301 https://$host$request_uri;
    }
    server_name cyb.h5.bb.uninote.com.cn;
    ssl_trusted_certificate     /etc/letsencrypt/live/cyb.h5.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate             /etc/letsencrypt/live/cyb.h5.bb.uninote.com.cn/fullchain.pem;
    ssl_certificate_key         /etc/letsencrypt/live/cyb.h5.bb.uninote.com.cn/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    ssl_stapling on;
    ssl_stapling_verify on;

    resolver 8.8.8.8 8.8.4.4 valid=600s;
    resolver_timeout 6s;

    location /MP_verify_5GQ2H9DxhaiHCsdB.txt {
        root /home/www;
        try_files $uri $uri/ /home/www/MP_verify_5GQ2H9DxhaiHCsdB.txt;
        charset utf-8;
    }
    location / {
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:9999;
    }
}

blindbox-admin-api 后台管理接口

.env

这个文件没有加入git,需要手动创建,测试环境参考:

APP_DEBUG = true
DAJX_API_HOST = 'https://dev.api.bb.uninote.com.cn'

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = shop
USERNAME = root
PASSWORD = root
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
PREFIX =

[API_DATABASE]
DATABASE = dajx-api

[LANG]
default_lang = zh-cn

[SWITCH]
refund = TRUE

本地环境参考:

APP_DEBUG = true
DAJX_API_HOST = 'http://a.dajx.my'
#设置当前环境的域名
SHOP_API = http://s.dajx.my

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 192.168.0.43
#HOSTNAME = localhost
DATABASE = shop
USERNAME = root
PASSWORD = root
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
PREFIX =

[API_DATABASE]
DATABASE = dajx-api
TYPE = mysql
HOSTNAME = 192.168.0.43
#HOSTNAME = localhost
USERNAME = root
PASSWORD = root
HOSTPORT = 3306
CHARSET = utf8

[REDIS]
HOSTNAME = 192.168.0.21
PORT = 6379

[LANG]
default_lang = zh-cn

[SWITCH]
#快递订阅开关,开启后会请求第三方接口,必须为真实快递单才会成功(并且有后续回调)
EXPRESS_OPEN = false
#快递回调签名开关,默认开启
EXPRESS_SIGN = false
#活动开始的群推开关,开启后,队列会触发igt的群推
IGT_APP = false
#单推,开启后才会调用第三发推送
IGT_SINGLE = false
#个推的环境前缀 其他环境 dajx_api_pre 等
IGT_PREFIX = dajx_api_cyb_
#真实退款开关,开启后会走真实退款, 默认false
REFUND = true
#自动确认收货时间,单位秒,正式环境设置15天 测试设置1小时
RECEIPT_TIME = 3600

client 客户端

用 uniapp 开发,一般开发时可以启动h5测试更方便,测试时在打包为小程序

  • baseUrl
    • 小程序:在 utils/config.js 中配置
    • h5 改manifest.json,和小程序不一样:
            "proxy" : {
                "/api" : {
                    "target" : "http://xx.com",
  • config/constant.js 存放其他常量

产品文档

使用说明

点赞(0) 阅读(9) 举报
目录
标题