未分类 Nginx 反向代理golang 后端 并指定某个目录前缀
#PROXY-START/api location /api { proxy_pass http://127.0.0.1:36007/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; rewrite ^/api/(.*) /$1 break; # 去掉前缀 proxy_http_version 1.1; # proxy_hide_header Upgrade; add_header X-Cache $upstream_cache_status; #Set Nginx Cache set $static_fileez…
服务器 docker-compose搭建consul集群环境
学习文章 https://www.jianshu.com/p/b246ae1e1bcd docker-compose.yaml 内容 version: '2' networks: byfn: services: consul1: image: consul container_name: node1 command: agent -server -bootstrap-expect=3 -node=node1 -bind=0.0.0.0 -client=0.0.0.0 -datacenter=dc1 networks: – byfn consul2: image: consul container_name: node2 command: agent -server -retry-join=node1 -node=node2 -bind=0.0.0.0 -client=0.0.0.0 -datacenter=dc1 depends_on: – consul1 networks: – byfn consul3: image: consul container_name:…
服务器 使用docker映射出来的端口不受防火墙规则管理的设置办法
添加规则 vim /etc/docker/daemon.json #追加下面参数: { "iptables":false } 重启服务 sudo systemctl daemon-reload sudo systemctl restart docker
服务器 Centos下运行shell一直提示 未预期的符号 `fi’ 附近有语法错误
#!/bin/bash a=10 b=10 if [ $a == $b ] then echo "a 等于 b" fi 一直提示 do.sh:行7: 未预期的符号 `fi' 附近有语法错误 do.sh:行7: `fi' 解决办法 # 多半因为/n/r导致的,将你的xx.sh替换下,语法: sed -i 's/\r$//' xxxxxxx.sh
golang golang 处理富文本内容img,为src增加前缀
// 用到的库 github.com/PuerkitoBio/goquery // 为 content 里面的 img src 增加前缀 // contont 内容 // profix 图片前缀 func replaceContentImgSrc(contont, profix string) (string, error) { doc, err := goquery.NewDocumentFromReader(strings.NewReader(contont)) if err != nil { return "", err } doc.Find("img").Each(func(i int, selection *goquery.Selection) { imgSrc, ok := selection.Attr("src") if ok { selection.SetAttr("src", profix+imgSrc) } }) html, err := doc.Html() if err != nil…
golang go-zero项目整套解决方案(转)
我现在一个项目 完全go-zero开发, 已经实现的用到技术栈 nginx做网关,统一auth鉴权 go-zero用http+grpc开发微服务业务(go-zero内部自适应限流、熔断) filebeat收集日志—> kafka —>gostash(代替logstash,go-zero作者开发的)上报数据到—->elasticsearch prometheus 监控go-zero的http、grpc服务(go-zero内部已封装好,直接配置就可以用) jager做链路追踪(go-zero内部已封装好,直接配置就可以用) 消息队列go-queue(kq的kafka,go-zero作者开发的) 定时任务、延时任务 asynq (这里也可以用go-queue的dq,go-zero作者开发的) 分布式事务 go-zero集成dtm 阿里云镜像服务,阿里云效做cicd , 直接发到阿里云k8s
前端 SCUI 是一个中后台前端解决方案,基于VUE3和elementPlus实现 lolicode/scui
介绍 SCUI 是一个中后台前端解决方案,基于VUE3和elementPlus实现。 使用最新的前端技术栈,提供各类实用的组件方便在业务开发时的调用,并且持续性的提供丰富的业务模板帮助你快速搭建企业级中后台前端任务。 SCUI的宗旨是 让一切复杂的东西傻瓜化。 地址 https://gitee.com/lolicode/scui
服务器 一条命令离线安装高可用kubernetes的库fanux/sealos
一条命令部署 Kubernetes 高可用集群 ? 只能用丝滑一词形容的kubernetes高可用安装(kubernetes install)工具,一条命令,离线安装,包含所有依赖,内核负载不依赖haproxy keepalived,纯golang开发,99年证书,支持v1.20.0 v1.19.5 v1.18.13 v1.17.15! 地址 https://github.com/fanux/sealos
服务器 graylog 搭建通过docker方式
前提 先建目录 /root/graylog/data ,并且给 777 权限 上传 docker-compose.yml 文件 到 /root/graylog 文件内容 version: '3' services: # MongoDB: https://hub.docker.com/_/mongo/ mongo: image: mongo:4.2 volumes: – ./data/mongo:/data/db networks: – graylog # Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/docker.html elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2 volumes: – ./data/es:/usr/share/elasticsearch/data environment: – http.host=0.0.0.0 – transpo…
前端 在浏览器上面唤起微信小程序的代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>标题</title> </head> <body> <script> var openlink = "weixin://dl/business/?t=xxxxx"; // 小程序代码 if(openlink!=''){ window.location = openlink }else{ console.log([])…
前端 vue 部署到Nginx时刷新404
location / { try_files $uri $uri/ /index.html; }
PHP WordPress插件 wp-rocket 高级用法Nginx配置文件
rocket.conf 文件内容 ################################################################################################### # Rocket-Nginx # # Rocket-Nginx is a NGINX configuration to speedup your WordPress # website with the cache plugin WP-Rocket (http://wp-rocket.me) # # Author: Maxime Jobin # URL: https://github.com/maximejobin/rocket-nginx # # Tested with WP-Rocket version: 2.6.15 # Tested with NGINX: 1.8.0 (stable) # # Version 1.1 # ################################################################…
前端 drone 编译 vue或者node之类的项目时使用缓存
下面配置大概的思路是这样的 从本机 /tmp/cache 目录还原缓存 执行更新依赖和编译命令 把最新的依赖复制到b本机 /tmp/cache 目录供下次使用 .drone.yml 文件 kind: pipeline name: default type: docker steps: – name: restore-cache #把缓存目录复制到根目录下的node_modules image: drillster/drone-volume-cache volumes: – name: cache path: /cache settings: restore: true # 这个配置还原缓存的意思 mount: # 此处配置需要复制的路径 – ./node_modules – name: 编译 image: node:12-alpine commands: – yarn – yarn build – name: rebuild-cache # 保存最新缓存到本地 image: drillster/drone-volume-cache volumes: – name: cache path…
服务器 Drone SETTINGS 页面没有 Trusted
近期使用drone,需要用到 volumes 挂载 host 磁盘的时候报错,经过搜索学习,是因为缺少启动配置所致 原安装文章 docker-compose.yml文件缺少一个 environment 新的 docker-compose.yml文件 如下 version: '3' services: drone-server: restart: always image: drone/drone:2 #这里是版本,可选1和2 ports: – "10003:80" volumes: – ./data/drone/:/var/lib/drone/ – ./data/data/:/data/ environment: – DRONE_GITEA_SERVER=https://gitea服务器地址 – DRONE_GITEA_CLIENT_ID=gitea生成的OAuth2客户端ID – DRONE_GITEA_CLIENT_SECRET=gitea生成的OAuth2客户端密钥 – DRONE_SERVER_HOST=drone服务器地址 – DRON…