From 931d7b0683b7dafe04255d370a38be1b14d5ec1e Mon Sep 17 00:00:00 2001 From: deepzz0 Date: Sat, 25 Feb 2017 19:35:23 +0800 Subject: [PATCH] document filing --- conf/app.yml | 7 ++-- conf/nginx/domain/deepzz.conf | 5 +-- conf/nginx/nginx.conf | 61 ----------------------------------- db.go | 5 ++- 4 files changed, 11 insertions(+), 67 deletions(-) diff --git a/conf/app.yml b/conf/app.yml index a3894cb..0edc31f 100644 --- a/conf/app.yml +++ b/conf/app.yml @@ -44,7 +44,7 @@ kodo: secretkey: BIrMy0fsZ0_SHNceNXk3eDuo7WmVYzj2-zrmd5Tf # 运行模式 mode: - # you can fix certfile, keyfile, domain + # 默认开启HTTP enablehttp: true httpport: 9000 enablehttps: false @@ -66,7 +66,8 @@ pingrpcs: - http://blogsearch.google.com/ping/RPC2 - http://rpc.pingomatic.com/ -# 以下数据初始化用,可在后台修改 +# 以下数据项供初始化使用,仅首次运行有效。 +# 若需要修改,请到博客后台操作。 account: # *后台登录用户名 username: deepzz @@ -87,5 +88,5 @@ blogger: beian: 蜀 ICP 备 16021362 号 # footer显示名称及tab标题: Deepzz's Blog btitle: Deepzz's Blog - # 版权声明: 本站使用「署名 4.0 国际」创作共享协议,转载请注明作者及原网址。 + # 版权声明 copyright: 本站使用「署名 4.0 国际」创作共享协议,转载请注明作者及原网址。 diff --git a/conf/nginx/domain/deepzz.conf b/conf/nginx/domain/deepzz.conf index a95744c..f788f74 100644 --- a/conf/nginx/domain/deepzz.conf +++ b/conf/nginx/domain/deepzz.conf @@ -47,7 +47,7 @@ server { # https://imququ.com/post/why-can-not-turn-on-ocsp-stapling.html ssl_trusted_certificate /data/eiblog/conf/ssl/full_chained.pem; - resolver 8.8.8.8 114.114.114.114 valid=300s; + resolver 114.114.114.114 8.8.8.8 valid=300s; resolver_timeout 10s; access_log /data/eiblog/logdata/nginx.log; @@ -66,6 +66,7 @@ server { expires 1d; } + # imququ 的上传文件相关,未用到 location ^~ /static/uploads/ { root /home/jerry/www/imququ.com/www; add_header Access-Control-Allow-Origin *; @@ -155,7 +156,7 @@ server { } } -# 原博客,内部做的转发 +# 博主原博客 server { server_name blog.deepzz.com; access_log /dev/null; diff --git a/conf/nginx/nginx.conf b/conf/nginx/nginx.conf index b6ffe6c..7d5dee4 100644 --- a/conf/nginx/nginx.conf +++ b/conf/nginx/nginx.conf @@ -58,74 +58,13 @@ http { index index.html index.htm; } - #error_page 404 /404.html; - # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} } - - # another virtual host using mix of IP-, name-, and port-based configuration - # - #server { - # listen 8000; - # listen somename:8080; - # server_name somename alias another.alias; - - # location / { - # root html; - # index index.html index.htm; - # } - #} - - - # HTTPS server - # - #server { - # listen 443 ssl; - # server_name localhost; - - # ssl_certificate cert.pem; - # ssl_certificate_key cert.key; - - # ssl_session_cache shared:SSL:1m; - # ssl_session_timeout 5m; - - # ssl_ciphers HIGH:!aNULL:!MD5; - # ssl_prefer_server_ciphers on; - - # location / { - # root html; - # index index.html index.htm; - # } - #} - include /data/eiblog/conf/nginx/domain/*.conf; } diff --git a/db.go b/db.go index 384c609..0f39a71 100644 --- a/db.go +++ b/db.go @@ -18,6 +18,7 @@ import ( "gopkg.in/mgo.v2/bson" ) +// 数据库及表名 const ( DB = "eiblog" COLLECTION_ACCOUNT = "account" @@ -30,6 +31,7 @@ const ( DELETE = "delete" ) +// blackfriday 配置 const ( commonHtmlFlags = 0 | blackfriday.HTML_TOC | @@ -96,7 +98,7 @@ func init() { ms.Close() // 读取帐号信息 Ei = loadAccount() - // 获取文章 + // 获取文章数据 Ei.Articles = loadArticles() // 生成markdown文档 go generateMarkdown() @@ -576,6 +578,7 @@ func QuerySerie(id int32) *Serie { return nil } +// 后台分页 func PageListBack(se int, kw string, draft, del bool, p, n int) (max int, artcs []*Article) { M := bson.M{} if draft {