Joyber 发布的文章

面板、插件版本:免费版 7.9.9

系统版本:CentOS 7.9.2009 x86_64(Py3.7.8) 

问题描述:原域名绑定了11个域名,申请的证书是多域名证书包含这11个域名,现在快到期了,其中一个域名已经过期,从域名绑定列表已经删除,问题是现在续签证书还是用的原来的11个域名进行申请,验证的时候提示域名无法访问

自己探索出来出宝塔的证书申请命令,使用如下命令即可快速申请好需要的证书,需要手动复制粘帖到网站证书设置里:

/www/server/panel/pyenv/bin/python /www/server/panel/class/acme_v2.py --domain  www.abc.com,www.abd.com --type http --path /www/wwwroot/www.abc.com

注意修改命令行的参数:域名以及网站目录,多域名英文逗号分隔

申请过程非常快,一会就有了证书,会提示证书保存目录,在后台管理面板申请要等一下(每个域名都要验证),这个命令这么快都不敢相信申请的是多域名证书~~

思路一:
先将数据进行进行排序,取最新的数据

select *
from 
(
select * from guiji where status = 1  having 1 order by kssj desc
) tmp group by xm

注意点
1、having 1 必须要带上,不然查询出来的数据有问题

思路二:
通过MAX函数获取最新的时间和地址(因为需要按照地址分组),然后作为一张表和原来的数据进行联查

SELECT t.* FROM (SELECT address,max(create_time) as create_time FROM test GROUP BY address) a LEFT JOIN test t ON t.address=a.address and t.create_time=a.create_time

注意点
2、address和create_time 必须一致,不一致会有问题

实战经验是通过Jenkins集成ansible插件做项目代码发布,以下是当时的playbook脚本

jenkins 执行的ansible执行类似:

/usr/bin/ansible-playbook /etc/ansible/playbook/deploy.houtai.yml -l houtai -f 5 --private-key /tmp/ssh11525745722860273680.key -u root -e srcdir=/var/lib/jenkins/workspace/www.com/ -e destdir=/web/www/ -e opts=--exclude-from=/etc/ansible/playbook/deploy.exclude --become-user root

deploy.houtai.yml 后台网站发布

- hosts: test,online
  remote_user: root
  tasks:
          - name: deploy code to remote server
            synchronize:
                    src: '{{ srcdir }}'
                    dest: '{{ destdir }}'
                    mode: push
                    dirs: yes
                    owner: no
                    group: no
                    copy_links: no
                    delete: no
                    rsync_opts: '{{ opts | default("") }}'

          - name: copy files if not existing, and delete extraneous files
            synchronize:
                    src: '{{ srcdir }}/{{ item }}'
                    dest: '{{ destdir }}/{{ item }}'
                    mode: push
                    dirs: yes
                    owner: no
                    group: no
                    copy_links: no
                    delete: yes
                    rsync_opts: '--ignore-existing'
            with_items:
                    - common/coreCss/
                    - common/coreJs/
                    - common/css/
                    - common/js/
            ignore_errors: true
                    
          - name: change files mode
            file:
                path: '{{ destdir }}/{{ item.0 }}'
                mode: '{{ item.1 }}'
            with_list:
                    - ['protected/yiic', '0755']
            ignore_errors: true

          - name: opcache_reset
            shell: /usr/bin/php -r 'opcache_reset();'
            ignore_errors: true

deploy.yml 用户网站发布

- hosts: test,online
  remote_user: root
  tasks:
          - name: deploy code to remote server
            synchronize:
                    src: '{{ srcdir }}'
                    dest: '{{ destdir }}'
                    mode: push
                    dirs: yes
                    owner: no
                    group: no
                    copy_links: no
                    delete: no
                    rsync_opts: '{{ opts | default("") }}'

          - name: copy files if not existing, and delete extraneous files
            synchronize:
                    src: '{{ srcdir }}/{{ item }}'
                    dest: '{{ destdir }}/{{ item }}'
                    mode: push
                    dirs: yes
                    owner: no
                    group: no
                    copy_links: no
                    delete: yes
                    rsync_opts:
                           - '--ignore-existing'
            with_items:
                    - common/coreCss/
                    - common/coreJs/
                    - common/css/
                    - common/js/
                    - pay/alipayMobile/alipay.config.php
                    - pay/alipayPC/alipay.config.php
                    - pay/singleTradeQuery/alipay.config.php
                    - wxpay/lib/WxPay.Config.php
            ignore_errors: true
                    
          - name: change files mode
            file:
                path: '{{ destdir }}/{{ item.0 }}'
                mode: '{{ item.1 }}'
            with_list:
                    - ['protected/yiic', '0755']
            ignore_errors: true

deploy.exclude 用于rsync同步文件时的忽略文件列表

.git
.idea
.user.ini
lextab.py
yacctab.py
/assets
/attachments
/uploads
node_modules
/protected/runtime
pay/alipayMobile/alipay.config.php
pay/alipayPC/alipay.config.php
pay/singleTradeQuery/alipay.config.php
#wxpay/lib/WxPay.Config.php