Skip to content
懒人博客,前后端分离,Vue+Beego Restful api 开箱即用,部署简单,后台管理系统简洁美观。好吧,我编不下去了...
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
conf 优化包导入路径 Mar 22, 2019
controllers 格式化文件 Mar 22, 2019
models 格式化文件 Mar 22, 2019
routers 格式化文件 Mar 22, 2019
sql
static 添加作品,简历链接 Mar 23, 2019
swagger 优化包导入路径 Mar 22, 2019
views
.DS_Store
.gitattributes 优化包导入路径 Mar 22, 2019
.travis.yml
LICENSE Create LICENSE Mar 23, 2019
README.md
lastupdate.tmp 优化包导入路径 Mar 22, 2019
main.go

README.md

LanBlog 一站式个人博客解决方案

Go Report Card GoDoc Build Status Build Status

感谢以下开源项目作者及参与者的无私奉献

技术栈

Vue.js + axios(ajax) +Beego Restful api + Mysql + Nginx

项目介绍

效果图

  • 首页

  • 侧边栏

  • 阅读界面

  • 后台登录界面

  • 后台管理界面

安装&使用

以Ubuntu为例

简单部署

下载对应的 压缩包 解压运行 具体步骤待补充...

手动编译安装

Step1 安装mysql

sudo apt update
sudo apt install mysql-server mysql-common mysql-client

安装完成后创建 myblog数据库或者其他名称,与项目目录conf下app.conf中mysqldb保持一致即可

	mysql -u root -p
	// 进入mysql后创建数据库
	
	create database myblog;
	
	//创建完成后退出
	
	exit;
	

Step2 安装Nginx

 sudo apt install nginx

Step 3 安装编译环境

若提示没有权限,请以root身份运行

  • 下载并安装go语言,配置环境变量
cd /usr/local
wget https://studygolang.com/dl/golang/go1.12.linux-amd64.tar.gz

tar zxvf  go1.12.linux-amd64.tar.gz

echo 'export GOROOT=/usr/local/go' >> ~/.bashrc 

echo 'export GOPATH=/var/www' >> ~/.bashrc 
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.bashrc 

source ~/.bashrc
	
  • 查看是否安装成功

输入go version查看go版本 输入go 查看命令提示

go version
go 

如果出现以下提示,则安装成功

  • 克隆项目到本地
cd /var/www

mkdir src

cd src

git clone https://github.com/sinksmell/LanBlog.git
  • 安装依赖

go get github.com/astaxie/beego

go get  github.com/beego/bee

go get github.com/dgrijalva/jwt-go

go get github.com/go-sql-driver/mysql


Step 3 安装编译环境

  • 修改Nginx配置文件

后台管理 blogCMS.conf

server {
listen 8088;
server_name localhost;
charset utf-8;
access_log /var/www/blogCMS.log  main;

location / {
  root /var/www/src/LanBlog/views;
  index index.html;
}

location ~ /(script|image|img|js|fonts|css)/ {
  expires 1d;
  root /var/www/src/LanBlog/static/blogCMS ;
}
    location /api {
            proxy_pass   http://localhost:8088/v1;
            add_header Access-Control-Allow-Methods *;
            add_header Access-Control-Max-Age 3600;
            add_header Access-Control-Allow-Credentials true;
            add_header Access-Control-Allow-Origin $http_origin;
            add_header Access-Control-Allow-Headers $http_access_control_request_headers;

            if ($request_method = OPTIONS ) {
                return 200;
            }
        }

}

blog.conf

server {
    listen 80;
    server_name localhost;
    access_log /var/www/blog.log  main;

    location / {
        root /var/www/src/LanBlog/views ;
        index home.html ;
    }

    location  ~ /(css|js|fonts|img|node_modules)/ {
       # access_log off;
        expires 1d;
        root /var/www/src/LanBlog/static/blog ;
    }

    location /api {
            proxy_pass   http://localhost:8088/v1;
            add_header Access-Control-Allow-Methods *;
            add_header Access-Control-Max-Age 3600;
            add_header Access-Control-Allow-Credentials true;
            add_header Access-Control-Allow-Origin $http_origin;
            add_header Access-Control-Allow-Headers $http_access_control_request_headers;

            if ($request_method = OPTIONS ) {
                return 200;
            }
        }
}

  • 运行项目
sudo  service nginx start

cd /var/www/src/LanBlog

bee run 

  • 运行效果图

  • 访问80端口

You can’t perform that action at this time.