快速入门

安装

  1. 把Go Blog项目拉到本地
  1. https://github.com/1920853199/go-blog.git
  1. 新建数据库,导入数据库文件,数据库文件/database/blog.sql

  2. 修改项目配置信息

  1. #conf/app.conf
  2. appname = go-blog
  3. httpport = 8888
  4. runmode = dev
  5. EnableAdmin = false
  6. sessionon = true
  7. url = 127.0.0.1:8888
  8. view = default
  9. limit = 10
  10. title = Go Blog
  11. autograph = 如今的我,谈不上幸福,也谈不上不幸。
  12. [db]
  13. dbType = mysql
  14. dbUser = root
  15. dbPass = root
  16. dbHost = 127.0.0.1
  17. dbPort = 3306
  18. dbName = blog
  19. [redis]
  20. rHost = 127.0.0.1
  21. rPort = 6379
  22. [wechat]
  23. AppID = xxxxxxx
  24. AppSecret = xxxxxxx
  25. Token = xxxxxxx
  26. EncodingAESKey = xxxxxxx
  1. 在go-blog 根目录下执行go run main.go ,访问 http://127.0.0.1:8888 即可

  2. 守护进程模式运行 可以了解PM2的相关信息,配置可查看start.sh 文件

账号

  1. 后台:http://127.0.0.1:8888/admin
  2. 账号:user
  3. 密码:123456

nginx代理示例

  1. server {
  2. listen 80;
  3. server_name go-blog.cn;
  4. root /home/data/go-blog;
  5. location ~ \.(txt|xml)$ {
  6. root /home/data/go-blog;
  7. }
  8. location / {
  9. proxy_pass http://127.0.0.1:8888;
  10. #proxy_redirect off;
  11. proxy_http_version 1.1;
  12. proxy_cache_bypass $http_upgrade;
  13. proxy_set_header Upgrade $http_upgrade;
  14. proxy_set_header Connection "upgrade";
  15. proxy_set_header Host $host;
  16. proxy_set_header X-Real-IP $remote_addr;
  17. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  18. proxy_set_header X-Forwarded-Proto $scheme;
  19. proxy_set_header X-Forwarded-Host $host;
  20. proxy_set_header X-Forwarded-Port $server_port;
  21. }
  22. access_log /home/wwwlogs/go-blog.access.log;
  23. }

非专业人员免费建站

如有需要建立属于自己的博客或者企业官网CMS请联系我微信