# wego **Repository Path**: yann2016/wego ## Basic Information - **Project Name**: wego - **Description**: beego项目 - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-01-09 - **Last Updated**: 2021-02-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # wego #### 介绍 beego项目 #### 软件架构 软件架构说明 #### 安装教程 1. go环境搭建 Mac GO环境配置 export PATH=$PATH:/usr/local/opt/go/libexec/bin export GOPATH=/Users/yann/Desktop/www/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN 2. 宝塔Linux面板-安装golang环境 cd /www/server && wget -O golang.tar.gz https://dl.google.com/go/go1.11.linux-amd64.tar.gz tar -xzvf golang.tar.gz vim /etc/profile export GOROOT=/www/server/go export GOBIN=$GOROOT/bin export GOPKG=$GOROOT/pkg/tool/linux_amd64 export GOARCH=amd64 export GOOS=linux export GOPATH=/www/wwwroot/Golang export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin source /etc/profile go version mkdir /www/wwwroot/Golang 3. 安装beego bee工具 数据库驱动 缓存工具 redis $ go get -u github.com/astaxie/beego $ go get -u github.com/beego/bee $ go get github.com/go-sql-driver/mysql $ go get github.com/astaxie/beego/cache $ go get -u github.com/astaxie/beego/cache/redis 4. apache 反向代理 宝塔 nginx 反向代理 ServerAdmin webmaster@dummy-host.example.com ServerName www.a.com ProxyRequests Off Order deny,allow Allow from all ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ server { listen 80; server_name go.sexgz.com; charset utf-8; #root /www/wwwroot/go.sexgz.com; #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则 #error_page 404/404.html; #SSL-END #ERROR-PAGE-START 错误页配置,可以注释、删除或修改 error_page 404 /404.html; error_page 502 /502.html; #ERROR-PAGE-END #PHP-INFO-START PHP引用配置,可以注释或修改 #include enable-php-00.conf; #PHP-INFO-END #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效 include /www/server/panel/vhost/rewrite/go.sexgz.com.conf; #REWRITE-END #禁止访问的文件或目录 location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) { return 404; } #一键申请SSL证书验证目录相关设置 location ~ \.well-known{ allow all; } location /(css|js|fonts|img)/ { access_log off; expires 1d; root "/path/to/app_a/static"; try_files $uri @backend; } location / { try_files /_not_exists_ @backend; } location @backend { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8088; } access_log /www/wwwlogs/go.sexgz.com.log; error_log /www/wwwlogs/go.sexgz.com.error.log; } 5. 跨域 路由设置 beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ AllowAllOrigins: true, //AllowOrigins: []string{"https://192.168.0.102"}, AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, AllowCredentials: true, })) 6. net 安装 $mkdir -p $GOPATH/src/golang.org/x/ $cd $GOPATH/src/golang.org/x/ $git clone https://github.com/golang/net.git net $go install net 7. 七牛安装 #go get -u github.com/qiniu/api.v7 官方的 有问题 go get -u qiniupkg.com/api.v7 #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)