leadscloud

Google SEO|外贸营销推广

Nginx服务器,可以安装ngx_pagespeed扩展,这样你的服务器下面的网站就可以自动通过pagespeed优化。网站返回的源码数据是经过pagespeed处理过的,比如处自动压缩css、html、javascript,图片自动压缩及处理为更小的格式webp。

同时包含一些最佳实践:

  • 优化缓存——整合应用程序的数据和逻辑
  • 最小化round-trip次数——削减连续的请求/响应周期数
  • 最小化请求开销——削减上传大小
  • 最小化负载大小——削减响应、下载及缓存页面大小
  • 优化浏览器渲染——改善浏览器页面布局
  • 移动方面的优化——优化站点移动网络和设备方面的相关特性

网站配置

你可以在nginx.conf中全局配置,也可以针对某个网站进行配置,放在虚拟主机配置server中

1
2
3
4
5
6
7
8
9
10
11
12
server
{
listen 80 default_server;
server_name _;
#listen [::]:80;
#server_name *.org *.in;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/youwebsite;

# 从这儿开始添加, 下面的代码放在这儿

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pagespeed on;

# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/ngx_pagespeed_cache;

pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters local_storage_cache;
pagespeed EnableFilters collapse_whitespace,remove_comments;
pagespeed EnableFilters outline_css;
pagespeed EnableFilters flatten_css_imports;
pagespeed EnableFilters move_css_above_scripts;
pagespeed EnableFilters move_css_to_head;
pagespeed EnableFilters outline_javascript;
pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters combine_css;
pagespeed EnableFilters rewrite_javascript;
pagespeed EnableFilters rewrite_css,sprite_images;
pagespeed EnableFilters rewrite_style_attributes;
pagespeed EnableFilters recompress_images;
pagespeed EnableFilters resize_images;
pagespeed EnableFilters convert_meta_tags;

# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

安装过程

1
2
3
4
5
6
7
8
9
10
11
12
#[check the release notes for the latest version]
NPS_VERSION=1.12.34.3-stable
cd
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
cd ngx_pagespeed-${NPS_VERSION}/
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/}
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/}
psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_RELEASE_NUMBER}.tar.gz
[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
wget ${psol_url}
tar -xzvf $(basename ${psol_url}) # extracts to psol/

修改lnmp include/upgrade_nginx.sh 文件

添加 --add-module=$HOME/ngx_pagespeed-${NPS_VERSION} ${PS_NGX_EXTRA_FLAGS}

参考资料

Google: Build ngx_pagespeed From Source
Github: Automatic PageSpeed optimization module for Nginx

其它一些国内外的数据报告网站,涵盖了较多行业、对了解一些行业的国际市场具有较大的帮助

一些行业报告网站

艾瑞咨询:http://www.iresearch.cn/
艾司隆:https://www.epsilon.com
CTR洞察中国:http://www.ctrchina.cn/
罗兰贝格:https://www.rolandberger.com
英敏特:http://china.mintel.com
麦肯锡:http://www.mckinsey.com.cn/
德勤中国:https://www2.deloitte.com/cn/zh.html
尼尔森中国:http://www.nielsen.com/cn/zh/insights.html?pageNum=1
华通明略:http://www.millwardbrown.com/subsites/china/home
波士顿咨询:https://www.bcg.com/zh-cn/default.aspx
埃森哲:https://www.accenture.com/cn-zh/new-applied-now
清科研究中心:http://report.pedata.cn/
贝恩:http://www.bain.cn/news.php
尼尔森网联:http://www.nielsenccdata.com/
普华永道:https://www.pwccn.com/zh
贝莱德:https://www.blackrock.com/cn
艾媒咨询:http://www.iimedia.cn/
IBM:https://www.ibm.com/cn-zh/
埃维诺:https://www.avanade.com/zh-cn
威勃庞尔:http://www.webpowerchina.com/
实力传播:http://socialbeta.com/t/company-agency-zenithoptimedia
iClick爱点击:http://www.i-click.com/zh/
Criteo:http://www.criteo.com/cn/resources/
百分点:http://www.baifendian.com/reports/
Trustdata:http://www.itrustdata.cn/
友盟:http://www.umeng.com/reports.html?from=hp
微博电视指数:http://tv.weibo.com/zhishu
星图数据:http://www.syntun.com.cn/datanews/hotspot.html
DCCI:http://www.dcci.com.cn/
知微数据:http://www.weiboreach.com/
胖鲸智酷:https://socialone.com.cn
秒针系统:http://www.miaozhen.com/
明思力中国:http://mslgroup.cn/cn/insights/
阿里研究院:http://www.aliresearch.com/blog/index/lists/tag/3827.html
百度营销研究院:http://bim.baidu.com/ir_main.php
DataEye : https://www.dataeye.com/report
易观智库:https://www.analysys.cn/college/
艺恩网:http://www.entgroup.cn/
Quest Mobile:http://www.questmobile.com.cn/blog.html
百度MOTA:http://mota.baidu.com/index.php/
中国行业报告研究中心:http://www.reportrc.com/index.html
今日报告网:http://www.imxdata.com/
Cheetah : http://lab.cmcm.com/sjfx/
BGC: https://www.bcg.com/zh-cn/default.aspx
腾讯的企鹅智库:http://re.qq.com/
阿里研究院:http://www.aliresearch.com/
CBNData:http://cbndata.com/home
360营销研究院:http://yingxiao.360.cn/

非www到 www 的规则

1
2
3
4
5
6
7
8
if ($request_uri ~ ^(.*/)index.html$) {
return 301 $1;
}
# non-www to www
if ($host !~* ^www\.){
rewrite ^(.*)$ $scheme://www.$host$1 permanent;
}

http 到 https 的

1
2
3
4
# http to https
if ( $scheme = http ){
return 301 https://$server_name$request_uri;
}

使用了cloudflare的https重定向设置

如果使用了cloudflare,http 到https的转向需要到cloudflare上面设置

How do I redirect all visitors to HTTPS/SSL?

20180307更新

添加两个page rules 301规则也行,之前的always https没这个选项了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
curl -X POST "https://api.cloudflare.com/client/v4/zones/<zone_id>/pagerules" \
-H "X-Auth-Email: <email>" \
-H "X-Auth-Key: <api_key>" \
-H "Content-Type: application/json" \
--data '{"targets":[{"target":"url","constraint":{"operator":"matches","value":"http://love4026.org/*"}}],"actions":[{"id":"forwarding_url","value":{"url": "https://www.love4026.org/$1", "status_code": 301}}],"priority":1,"status":"active"}'

curl -X POST "https://api.cloudflare.com/client/v4/zones/<zone_id>/pagerules" \
-H "X-Auth-Email: <email>" \
-H "X-Auth-Key: <api_key>" \
-H "Content-Type: application/json" \
--data '{"targets":[{"target":"url","constraint":{"operator":"matches","value":"http://www.love4026.org/*"}}],"actions":[{"id":"forwarding_url","value":{"url": "https://www.love4026.org/$1", "status_code": 301}}],"priority":1,"status":"active"}'

curl -X POST "https://api.cloudflare.com/client/v4/zones/<zone_id>/pagerules" \
-H "X-Auth-Email: <email>" \
-H "X-Auth-Key: <api_key>" \
-H "Content-Type: application/json" \
--data '{"targets":[{"target":"url","constraint":{"operator":"matches","value":"https://love4026.org/*"}}],"actions":[{"id":"forwarding_url","value":{"url": "https://www.love4026.org/$1", "status_code": 301}}],"priority":1,"status":"active"}'

设置好后使用

1
curl -I http://love4026.org

看下结果即可

1
2
3
4
5
6
7
8
9
[root@centos-1gb-nyc3-01 ~]# curl -I http://love4026.org
HTTP/1.1 301 Moved Permanently
Date: Wed, 07 Mar 2018 02:14:15 GMT
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Wed, 07 Mar 2018 03:14:15 GMT
Location: https://www.love4026.org/
Server: cloudflare
CF-RAY: 3f798c2c75a346f8-EWR

忠仕的商务通是我们公司一直使用的产品,虽然产品多少年不更新,最近更新了代码适应了移动端也不太友好,但奈何人员已经用习惯了,还是一直用它。每年300元一个席位还是很便宜的。

它的主要劣势是:

  • 代码不支持异步
  • 对移动端支持不好(目前访问50%以上是移动端过来的)
  • 服务器在国内,速度方面不太好
  • 无法内嵌google统计代码包括无法跟踪事件和转化

如果是做国际业务的,在预算充足的情况下,还是建议使用 https://www.livechatinc.com/

默认的忠仕商务通聊天界面url

1
http://kht.zoosnet.net/LR/Chatpre.aspx?id=KHT57158997&lng=en

自定义网址,如果想在其它未验证网页中使用商务,并且希望商务通的来源网址更改为特定的,可以按下面方式使用

1
http://kht.zoosnet.net/LR/Chatpre.aspx?id=KHT57158997&lng=en&r=refer.com&p=baidu.com

url参数说明

1
2
3
4
5
6
lng: en # 语言类型
id: KHT57158997 # 站点ID
p: www.lanthy.com # 当前网页的网址,用于向客服人员提供访客轨迹
r: www.google.com # 上一访问网页的网址,用于向客服人员提供访问来源
oname: anan # 直接和选择的客服进行对话
e: "test" # 对话入口说明,可以不填写,客服在“信息”选项卡里会看到以下内容,支持html代码

以上的url适合自定义按钮弹出聊天窗口的设置,默认的商务通点击弹出,还是会是默认的,但我们也有办法修改,商务通代码中提供了一个自定义函数 openZoosUrl_UserDefine , 我们只要写一个openZoosUrl_UserDefine函数 就可以了,下面的是代码就是我修改的,可以修改商务通来源网址。

自定义默认的聊天窗口弹出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<script>
function openZoosUrl_UserDefine(url, data) {
// 修改下面的url地址即可
var p = 'http://www.miningroadheader.com/' + '?p1=' + escape(location.href);
if (typeof (LR_istate) != 'undefined') {
LR_istate = 3;
}
var lr_url1 = url;
if (typeof (LR_opentimeout) != 'undefined' && typeof (LR_next_invite_seconds) != 'undefined') LR_next_invite_seconds = 999999;
if (url == 'sendnote') {
url = LR_sysurl + 'LR/Chatwin2.aspx?siteid=' + LR_websiteid + '&cid=' + LR_cid + '&sid=' + LR_sid + '&lng=' + LR_lng + '&p=' + escape(location.href) + lr_refer5238();
} else {
url = ((LR_userurl0 && typeof (LR_userurl) != 'undefined') ? LR_userurl : (LR_sysurl + 'LR/Chatpre.aspx')) + '?id=' + LR_websiteid + '&cid=' + LR_cid + '&lng=' + LR_lng + '&sid=' + LR_sid + '&p=' + escape(p) + lr_refer5238();
}
if (typeof (LR_UserSSL) != 'undefined' && LR_UserSSL && url.charAt(4) == ':') url = url.substring(0, 4) + 's' + url.substring(4, url.length);
if (!data) {
if (typeof (LR_explain) != 'undefined' && LR_explain != '') {
url += '&e=' + escape(escape(LR_explain));
} else if (typeof (LiveAutoInvite1) != 'undefined') {
url += '&e=' + escape(escape(LiveAutoInvite1));
}
}
if (typeof (LR_username) != 'undefined') {
url += '&un=' + escape(LR_username);
}
if (typeof (LR_userdata) != 'undefined') {
url += '&ud=' + escape(LR_userdata);
}
if (typeof (LR_ucd) != 'undefined') {
url += '&ucd=' + escape(LR_ucd);
}
url += '&msg=' + escape(LR_msg);
if (data) url += data;
url += '&d=' + new Date().getTime();
if (typeof (LR_imgint) != 'undefined') url += '&imgint=' + LR_imgint;
if (lr_url1 == 'fchatwin') {
LR_ClientEnd = 0;
window.location = url + '&f=1';
return;
}
if (LR_sidexists != 2 && LiveReceptionCode_isonline && lr_url1 != 'bchatwin' && typeof (LR_pm003) != 'undefined' && LR_pm003 == 1) {
LR_HideInvite();
LR_istate = 1;
clickopenmini = 1;
LR_showminiDiv();
lrminiMax();
return;
}

var oWindow;
try {
if (LR_checkagent('opera|safari|se 2.x')) {
oWindow = window.open(url);
} else {
oWindow = window.open(url, 'LRWIN_' + LR_websiteid, 'toolbar=no,width=760,height=460,resizable=yes,location=no,scrollbars=no,left=' + ((screen.width - 760) / 4) + ',top=' + ((screen.height - 460) / 4));
}
if (oWindow == null) {
LR_ClientEnd = 0;
window.location = url;
return;
}
oWindow.focus();
} catch (e) {
if (oWindow == null) {
LR_ClientEnd = 0;
window.location = url;
}
}
return true;
}
</script>
<script src="//kht.zoosnet.net/JS/LsJS.aspx?siteid=KHT57158997&float=1&lng=en"></script>

jQuery下zoosnet代码加载

如果你使用了jQeury,商务通代码可以这样加载,忠仕的商务通代码应该是上个年代写的,不支持异步

1
2
3
4
5
6
7
8
9
10
11
<script>
window.onload=function(){
var t=document.write;
document.write=function(t){
$("body").append(t)
},
$.getScript("https://kht.zoosnet.net/JS/LsJS.aspx?siteid=KHT57158997&float=1&lng=en",function(){
setTimeout(function(){document.write=t},3e3)
})
}
</script>

安装discourse

1
2
3
4
mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
cp samples/standalone.yml containers/app.yml

修改app.yml文件

文件修改如果错了,再重新编绎非常花时间,所以最好一次搞定,还是就是邮箱非常重要,填写真实的。

1
2
3
4
5
6
templates:
"templates/postgres.template.yml"
"templates/redis.template.yml"
"templates/sshd.template.yml"
"templates/web.template.yml"
"templates/web.china.template.yml"

配置文件的这个部分,需要添加- “templates/web.china.template.yml”;否则在./launcher bootstrap app初始化时会报错RuntimeError: …,原因得问GWF。

1
2
## on initial signup example'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'henry@outlook.com'

这里是开发者邮箱的设置,用于接收discoures论坛的官方邮件,只针对开发运营这个论坛的开发者。

1
2
## TODO: The domain name this Discourse instance will respond to
DISCOURSE_HOSTNAME: 'weifuwu.ren'

域名设置没设么可说的,没有的话,用绑定的外网IP地址访问discourse也可以,购买了域名可以按照指南到域名管理界面,进行设置;

1
2
3
4
5
6
7
DISCOURSE_SMTP_ADDRESS:smtp.mxchina.com
DISCOURSE_SMTP_PORT:25
DISCOURSE_SMTP_USER_NAME: info@weifuwu.ren
DISCOURSE_SMTP_PASSWORD: xxxxxxx
DISCOURSE_SMTP_ENABLE_START_TLS: true
DISCOURSE_SMTP_AUTHENTICATION: login
DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none

重点是在邮箱设置,我申请的阿里云邮箱

1
2
3
DISCOURSE_SMTP_PASSWORD: xxxxxxx设置的就是邮箱密码;
DISCOURSE_SMTP_PORT:端口设置25,
DISCOURSE_SMTP_ADDRESS:Host是smtp.mxchina.com,

DISCOURSE_SMTP_USER_NAME: 这里的设置最最重要的,这个邮箱又叫notification email 被用于发送所有重要系统邮件的邮箱地址。指定的域名必须正确设置 SPF、DKIM 和反向 PTR 记录以发送邮件。一般和域名绑定在一起,比如info@weifuwu.com 或者 admin@weifuwu.com 都行,这样收到邮件的发帖人或回复人感觉比较正式,使用这个邮箱也是最频繁的。关于SPF、DKIM设置有篇文章可参考1
如果您使用的阿里云的企业邮箱,域名解析后可以不用设置 SPF、DKIM 了已经设置好了,注意阿里云这里设置DISCOURSE_SMTP_ADDRESS:smtp.mxhichina.com

使用代理

因为国内网络环境的问题,./launcher rebuild app 操作经常卡壳,这时就需要配置个代理:discourse服务器上使用代理

编辑app.yml在env:下添加代理地址:

1
2
HTTP_PROXY: http://example.org:12345
HTTPS_PROXY: http://example.org:12345

加入国内镜像

1
2
3
echo "DOCKER_OPTS=\"\$DOCKER_OPTS –registry-mirror=https://docker.mirrors.ustc.edu.cn\"" | sudo tee -a /etc/default/docker

sudo service docker restart

初始化discourse

1
2
3
./launcher bootstrap app
# 启动discourse服务,就OK了!
./launcher start app

手动创建管理员账户

1
2
3
4
5
./launcher enter app

rake admin:create

exit

访问网站地址,成功打开就完成了

扩展安装

用 Let’s Encrypt 添加 https 证书

添加模板

添加 web.ssl.template.ymlweb.letsencrypt.ssl.template.yml 模板

注意:如果你正在使用 web.socketed.template.yml ,不用继续看这篇了。
你应该在主机上设置 Let’s Encrypt 的客户端。客户端无法在 unix socket 上进行验证。

在app.yml文件中添加

1
2
3
4
templates:
- "templates/web.template.yml"
- "templates/web.ssl.template.yml"
- "templates/web.letsencrypt.ssl.template.yml"

暴露 443 端口

1
2
3
expose:
- "80:80"
- "443:443"

给 Let’s Encrypt 添加个注册用邮箱账号

1
2
env:
LETSENCRYPT_ACCOUNT_EMAIL: email@awesomedomain.com

运行rebuild命令

1
./launcher rebuild app

修改文章的永久链接

Replace all instances of the old name with the new name in posts

All the existing posts will still refer to the old domain. Let’s fix that:

1
2
3
./launcher enter app
discourse remap talk.foo.com talk.bar.com
rake posts:rebake

This remaps text in posts from the old URL to the new URL, then regenerates all posts just in case.

我的app.yml配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
#- "templates/web.ssl.template.yml"
#- "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
- "801:80" # http
# - "4443:443" # https

params:
db_default_text_search_config: "pg_catalog.english"

## Set db_shared_buffers to a max of 25% of the total memory.
## will be set automatically by bootstrap based on detected RAM, or you can override
#db_shared_buffers: "256MB"

## can improve sorting performance, but adds memory usage per-connection
#db_work_mem: "40MB"

## Which Git revision should this container use? (default: tests-passed)
#version: tests-passed
version: stable

env:
LANG: en_US.UTF-8
DISCOURSE_DEFAULT_LOCALE: zh_CN
# DISCOURSE_DEFAULT_LOCALE: en

## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
#UNICORN_WORKERS: 3

## TODO: The domain name this Discourse instance will respond to
DISCOURSE_HOSTNAME: 'bbs.lanthy.com'

## Uncomment if you want the container to be started with the same
## hostname (-h option) as specified above (default "$hostname-$config")
#DOCKER_USE_HOSTNAME: true

## TODO: List of comma delimited emails that will be made admin and developer
## on initial signup example 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'yourname@lanthy.com,test@qq.com'

## TODO: The SMTP mail server used to validate new accounts and send notifications
DISCOURSE_SMTP_ADDRESS: smtp.exmail.qq.com # required
DISCOURSE_SMTP_PORT: 587 # (optional, default 587)
DISCOURSE_SMTP_USER_NAME: yourusername@lanthy.com # 这儿填写你的邮箱地址
DISCOURSE_SMTP_PASSWORD: yourpassword # 邮箱密码 required, WARNING the char '#' in pw can cause problems!
DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
DISCOURSE_SMTP_AUTHENTICATION: login
DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
#DISCOURSE_SMTP_PASSWORD

## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
#LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

## The CDN address for this Discourse instance (configured to pull)
## see https://meta.discourse.org/t/14857 for details
#DISCOURSE_CDN_URL: //discourse-cdn.example.com

## The Docker container is stateless; all data is stored in /shared
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
host: /var/discourse/shared/standalone/log/var-log
guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/angusmcleod/discourse-topic-previews.git
- git clone https://github.com/discourse/discourse-staff-notes.git
- git clone https://github.com/discourse/discourse-solved.git
- git clone https://github.com/discourse/discourse-push-notifications.git
- git clone https://github.com/discourse/discourse-voting.git
- git clone https://github.com/ekkans/lrqdo-editor-plugin-discourse.git
- git clone https://github.com/discourse/discourse-translator.git

## Any custom commands to run after building
run:
- exec: echo "Beginning of custom commands"
## If you want to set the 'From' email address for your first registration, uncomment and change:
## After getting the first signup email, re-comment the line. It only needs to run once.
- exec: rails r "SiteSetting.notification_email='zhanglei@lanthy.com'"
- exec: echo "End of custom commands"

论坛域名配置 使用Nginx

域名 bbs.lanthy.com 的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
lanthy@ubuntu:/var/discourse$ cat /usr/local/nginx/conf/vhost/bbs.lanthy.com.conf 
server
{
listen 80;
#listen [::]:80;
server_name bbs.lanthy.com ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/bbs.lanthy.com;

include none.conf;
#error_page 404 /404.html;

# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://127.0.0.1:801/;
#proxy_redirect http://bbs.lanthy.com:801 http://bbs.lanthy.com:80;

# Socket.IO Support
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";
}

#include enable-php.conf;

#location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
#{
# expires 30d;
#}

#location ~ .*\.(js|css)?$
#{
# expires 12h;
#}

#location ~ /.well-known {
# allow all;
#}

location ~ /\.
{
deny all;
}

access_log off;
}

删除命令

1
2
3
4
5
6
7
8
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_PATH' --prune-empty --tag-name-filter cat -- --all

git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all

git gc --prune=now
git gc --aggressive --prune=now
上面的FILE_PATH要是路径而不只是文件名字

参考资料

Removing sensitive data from a repository

使用 networksetup 修改

修改ip地址、子网掩码、网关

1
sudo networksetup -setmanual "Ethernet" 116.193.49.157 255.255.255.224 116.193.49.129 

设置 DNS 服务器

1
sudo networksetup -setdnsservers "Ethernet" 202.96.209.5 202.96.209.133

设置mac地址

1
sudo ifconfig en0 ether 10********C8 

上面是一个一次性的改法, 重启后会自动变为本机原本的mac地址。

使用 ifconfig 修改

设置 IP 和 子网掩码

1
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 

设置网关

1
route add default gw 192.168.1.1

设置 DNS

1
2
3
4
vi /etc/resolv.conf

nameserver 114.114.114.114
nameserver 114.114.115.115

查看周围 WiFi

1
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s

查看本机的无线网卡设备

ifconfig

抓包

1
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en1 sniff 6

en1是无线网卡设备;6是要破解wifi的CHANNEL。

使用手机连接 wifi,再断开, 获得的包放在/tmp

使用字典破解密码

1
sudo aircrack-ng -w password.txt -b c8:3a:35:30:3e:c8 /tmp/*.cap

/Users/zhang/Downloads/crackstation-human-only.txt

-w:指定字典文件;-b:指定要破解的wifi BSSID

GoProxy全局代理设置

httpproxy.json 修改 Address 127.0.0.1:8087 为

1
"Address": "0.0.0.0:8087",

证书设置

局域网的其它电脑即可使用你的代理,代理主机为你的电脑 IP, 但如果其它电脑没有安装证书,还是不能访问国外网站,会提示你证书不对.

在使用代理前进行如下操作, 使用浏览器打开 http://192.168.10:8087 下载证书,然后导入,导入时不要选择自动操作, 浏览中选“受信任根证书”. 之后局域网的其它电脑主可以使用你的 goproxy 代理自由畅游了.

wordpress转为hexo博客,导出的时候有些小问题,记录一下。

下划线转义问题

hexo-util/lib/slugize.js
va rSpecial 更改下下划线

文章标题中含有特殊字符串问题

hexo-migrator-wordpress/index.js

90多行上下, 改为: title: slug || title

0%