Skip to content

Commit

Permalink
backup
Browse files Browse the repository at this point in the history
  • Loading branch information
masteranthoneyd committed Aug 14, 2018
1 parent 9d1ff50 commit 60c0076
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 55 deletions.
6 changes: 6 additions & 0 deletions disqus-proxy-server-docker.md
@@ -0,0 +1,6 @@
```
docker run -d --name disqus-proxy -p 5509:5509 \
-e API_SECRECT=SnHXSv8uCu7MMfvmADaB9g3QmdwhB0Hnlw4676hi3CgRkksoC4Ab57oSHwo2sVv2 \
-e SHORT_NAME=ookamiantd \
ycwalker/disqus-proxy-server
```
66 changes: 12 additions & 54 deletions source/_posts/build-blog-hexo-advanced.md
Expand Up @@ -296,72 +296,30 @@ var disqus = {
流程就没什么好说的了,如上图,在前端页面上测试 disqus 加载是否成功,如果成功则显示 disqus 的评论框,反之加载独立的评论框...
具体请看***[https://ycwalker.com/2017/06/01/about-diqus-proxy/](https://ycwalker.com/2017/06/01/about-diqus-proxy/)***

### Deploy Disqus-Proxy
首先你得有一台**可以访问[Disqus](https://disqus.com/)**的VPS[^1]... 博主用的是***[Linode](www.linode.com)***

### Node.js
后端采用了`Koa` 框架和 `async/await` 语法,`Node.js` 版本 `7.6` 以上。

![](http://ojoba1c98.bkt.clouddn.com/img/disqus-proxy/node-js-version.png)

### Clone Project
`cd`到想要安装的目录下,然后:
```bash
git clone https://github.com/ciqulover/disqus-proxy
```

### Dependency
要运行起来首先要安装依赖,`cd`到项目里面执行:
```bash
npm i --production
// 或者
yarn install --production
```

### Configuration
配置 `server` 目录下的`config.js`
```json
module.exports = {
// 服务端端口,需要与 disqus-proxy 前端设置一致
port: 5509,
// 你的 diqus secret key
api_secret: 'your secret key',
// 你的 disqus 名称
username:'ciqu',
// 服务端 socks5 代理转发,便于在本地测试,生产环境通常为 null
socks5Proxy: null,
// 日志输出位置, 输出到文件或控制台 'file' | 'console'
log: 'console'
}
```

### Get Api-secret
`api-secret` 需要你在 ***[Disqus Api](https://disqus.com/api/applications/)*** 的官方网站上开启 **API** 权限,申请成功后会得到这个秘钥。
![](http://ojoba1c98.bkt.clouddn.com/img/disqus-proxy/disqus-api-applcation.png)

并且需要在后台的 `Settings` => `Community` 里开启访客评论:
![](http://ojoba1c98.bkt.clouddn.com/img/disqus-proxy/disqus-admin-setting.png)

### Start Up
使用 `pm2` 启动:
```bash
cd server
npm i pm2 -g
pm2 start index.js
```
如果你在配置文件中选择 `log` 类型为`file`, 那么输出的日志文件将在默认为 server 目录下的`disqus-proxy.log`
### Deploy Disqus-Proxy

使用`netstat`查看项目监听情况:
首先你得有一台**可以访问[Disqus](https://disqus.com/)**的VPS[^1]... 博主用的是***[Linode](www.linode.com)***

```bash
netstat -nutpl
```
Docker方式启动:

![](http://ojoba1c98.bkt.clouddn.com/img/disqus-proxy/disqus-proxy-startup.png)
```
docker run -d --name disqus-proxy --restart=always -p 5509:5509 \
-e API_SECRECT=your_serect \
-e SHORT_NAME=your_short_name \
ycwalker/disqus-proxy-server
```

那么后端的工作就完成了~
更多方式请移步到 ***[https://github.com/ciqulover/disqus-proxy-server](https://github.com/ciqulover/disqus-proxy-server)***

### NexT Configuration

#### Copy Static File
`disqus-proxy`项目中`/build/static`文件复制到博客`../next/source/`下。
`static`文件中应该包含`main.0d0338ae.js``main.0603c539.css`
Expand Down Expand Up @@ -491,7 +449,7 @@ image_minifier:

这是翻墙状态:
![](http://ojoba1c98.bkt.clouddn.com/img/disqus-proxy/comment02.png)
这是disqus_proxy
这是`disqus_proxy`
![](http://ojoba1c98.bkt.clouddn.com/img/disqus-proxy/comment01.png)

## 修改文章页宽
Expand Down
34 changes: 34 additions & 0 deletions source/_posts/nginx-noob-guide.md
Expand Up @@ -406,9 +406,43 @@ server{

这里有***[更多](http://nginx.org/en/docs/http/ngx_http_proxy_module.html)***的可能更加有用的配置代理连接的指令。

## 快速查看配置文件的方法

nginx的配置放在nginx.conf文件中,一般我们可以使用以下命令查看服务器中存在的nginx.conf文件。

```
locate nginx.conf
/usr/local/etc/nginx/nginx.conf
/usr/local/etc/nginx/nginx.conf.default
...1234
```

如果服务器中存在多个nginx.conf文件,我们并不知道实际上调用的是哪个配置文件,因此我们**必须找到实际调用的配置文件**才能进行修改。

## 查看NGINX实际调用的配置文件

### 1.查看NGINX路径

```
ps aux|grep nginx
root 352 0.0 0.0 2468624 924 ?? S 10:43上午 0:00.08 nginx: worker process
root 232 0.0 0.0 2459408 532 ?? S 10:43上午 0:00.02 nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;
root 2345 0.0 0.0 2432772 640 s000 S+ 1:01下午 0:00.00 grep nginx1234
```

NGINX的路径为:`/usr/local/opt/nginx/bin/nginx`

### 2.查看NGINX配置文件路径

使用NGINX的 `-t` 参数进行配置检查,即可知道实际调用的配置文件路径及是否调用有效。

```
/usr/local/opt/nginx/bin/nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful123
```

测试可知,NGINX的配置文件路径为:`/usr/local/etc/nginx/nginx.conf` 且调用有效。

# 最后
> 参考:
Expand Down
Expand Up @@ -951,7 +951,6 @@ python speedtest-cli/setup.py install
speedtest-cli --server=6611
```
[^1]: 防火长城(英语:Great Firewall( of China),常用简称:GFW,中文也称中国国家防火墙,中国大陆民众俗称防火墙等),是对中华人民共和国政府在其互联网边界审查系统(包括相关行政审查系统)的统称。此系统起步于1998年,其英文名称得自于2002年5月17日Charles R. Smith所写的一篇关于中国网络审查的文章《The Great Firewall of China》,取與Great Wall(长城)相谐的效果,简写为Great Firewall,缩写GFW。隨着使用的拓广,中文「墙」和英文「GFW」有时也被用作动词,网友所說的「被墙」即指被防火长城所屏蔽,「翻墙」也被引申为浏览国外网站、香港等特区网站的行为。

0 comments on commit 60c0076

Please sign in to comment.