nginx proxy_pass 500错误

在前后端分离项目的时候,为了不会跨域,通过反向代理来处理接口请求问题 nginx配置 location /api { proxy_pass http://example.com; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; } 但是请求的时候一直都是500

nginx proxy_pass

nginx 配置反向代理是url问题,主要有几种情况 1. proxy_pass 最后没有加/ location /api { proxy_pass http://example.com; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; } 如果访问地址http://localhost/api

gorm runtime error: invalid memory address or nil pointer dereference

在做数据插入的时候 user := User{Name: UserData["name"], Mobile: UserData["mobile"]} res := db.Create(&user) 代码运行之后提示 runtime error: invalid memory address or nil pointer dereference 原来是db变量在初始化作用域的问题 var db *gorm.DB func InitDB(conf *config.Config) *gorm.DB { dsn := conf.Database.User + ":" + conf.Database.Pwd + "@tcp(" +

Linux 防止定时任务重复执行

涉及到一些定时任务的时候,我们首先想到的就是crontab */1 * * * * sh /root/task.sh >> /root/logs/task.log 2>&1 &1 标准输出 2:标准错误 command >> file 2>&1 command » file将标准输出重定向到f