Disqus后的评论系统—— 基于 LeanCloud 的 Valine

偶然看到这个评论系统,解决了disqus被墙后的评论系统问题,现在我也在用~

使用方法:

一、 Leancloud 设置

  1. 注册Leancloud
  2. 创建应用
  3. 选择刚刚创建的应用>设置>选择应用 Key,然后你就能看到APP IDAPP KEY
  4. 填写应用>设置>安全设置中的Web 安全域名

    二、添加js代码

在文件中的 </body> 前插入下方的代码即可:

<!--载入js,在</body>之前插入即可-->
<!--Leancloud 操作库:-->
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<!--Valine 的核心代码库-->
<script src="./dist/Valine.min.js"></script>
<body>
    <div class="comment"></div>
    <script>
	 new Valine({
		 av: AV, 
		 el: '.comment', // 
		 app_id: 'Your APP ID', // 这里填写上面得到的APP ID
		 app_key: 'Your APP KEY', // 这里填写上面得到的APP KEY
		 placeholder: 'ヾノ≧∀≦)o来啊,快活啊!' // [v1.0.7 new]留言框占位提示文字
	});
  </script>
</body>

至此,评论系统ok了。


主办、承办、协办、赞助、支持的区别 - 知乎

主办方:大、中型会议一般会把主办方写成某某政府单位、某大型公司集团,类似于指导机构、上级机构的意思,实际上并不在会议中担任组织和管理角色。比如说某全国性的协会在上海办一场会议,上海地区的承办单位就会把主办方写成该全国性的协会。小型会议没有这些官面文章,会议是哪家单位办的就写谁。

承办方:大中型会议的实际主办单位,可以是公司某部门、协会某会员单位、政府部门单位里的下级机构。小型会议一般不写承办方(如有,一般是场地提供方)。

协办方:不以会议规模大小做区别,因会议需要而设定,是会议主办方或承办方的合作单位,特点是该单位必须参与会议的组织和管理。

赞助与支持:赞助单位和支持单位基本属于一个意思,一般以出资多少(或以赞助资源价值衡量)决定排序先后,少则可以分为特别赞助和一般赞助,多则可以分为钻石赞助、黄金赞助、白银赞助、赞助等类别,多或少依据会议规模大小以及所需资源大小而决定。

转自:https://www.zhihu.com/question/37693033/answer/106386478


tomcat 与 nginx,apache的区别

Apache HTTP Server Project: 一款开源的HTTP服务器软件,来自apache基金会;

Nginx 也是一款开源的HTTP服务器软件(当然它也可以作为邮件代理服务器、通用的TCP代理服务器),来自俄罗斯。

HTTP服务器通常运行在服务器之上,绑定服务器的IP地址并监听某一个tcp端口来接收并处理HTTP请求,这样客户端(IE, Firefox,Chrome等浏览器)就能够通过HTTP协议来获取服务器上的网页(HTML格式)、文档(PDF格式)、音频(MP4格式)、视频(MOV格式)等等资源。

然而 Apache HTTP Server 和 Nginx 本身不支持生成动态页面,但它们可以通过其他模块来支持(例如通过Shell、PHP、Python脚本程序来动态生成内容)。

如果想要使用Java程序来动态生成资源内容,需要使用 Java Servlet 技术以及衍生的 Java Server Pages 技术。而 Tomcat 就是支持运行Servlet/JSP应用程序的容器,能够动态的生成资源并返回到客户端。

虽然 Tomcat 也可以认为是HTTP服务器,但基于动静态资源分离和方便 tomcat 水平扩展的原则,Tomcat 通常仍然会和 Nginx 或 apache 配合在一起使用。


DNS缓存服务 — NSCD

偶然发现,自己的服务器上运行着一个叫 nscd 的服务。

所谓 nscd(Name Service Cache Daemon),是一种能够缓存 passwd、group、hosts 的本地缓存服务,分别对应三个源 /etc/passwd/etc/hosts/etc/resolv.conf

每个源保存两份缓存,一份是找到记录的,一份是没有找到记录的。每一种缓存都保存有生存时间(TTL)。其作用就是在本当中增加cache ,加快如DNS的解析等的速度。

安装

  • RHEL/CentOS
$ yum -y install nscd

缓存文件路径为/var/db/nscd/

  • Debian/Ubuntu
$ apt-get install nscd

nscd 的缓存文件路径为/var/cache/nscd/

命令

nscd 服务默认是关闭的,通过service nscd start开启。

  • 查看统计信息
$ nscd -g
  • 清除缓存
# 当更改完域名指向后,清除dns缓存
$ nscd -i hosts

  • 关闭服务
$ nscd -K

配置

阿里云的配置如下:

#
# /etc/nscd.conf
#
# An example Name Service Cache config file.  This file is needed by nscd.
#
# Legal entries are:
#
#	logfile			<file>
#	debug-level		<level>
#	threads			<initial #threads to use>
#	max-threads		<maximum #threads to use>
#	server-user             <user to run server as instead of root>
#		server-user is ignored if nscd is started with -S parameters
#       stat-user               <user who is allowed to request statistics>
#	reload-count		unlimited|<number>
#	paranoia		<yes|no>
#	restart-interval	<time in seconds>
#
#       enable-cache		<service> <yes|no>
#	positive-time-to-live	<service> <time in seconds>
#	negative-time-to-live   <service> <time in seconds>
#       suggested-size		<service> <prime number>
#	check-files		<service> <yes|no>
#	persistent		<service> <yes|no>
#	shared			<service> <yes|no>
#	max-db-size		<service> <number bytes>
#	auto-propagate		<service> <yes|no>
#
# Currently supported cache names (services): passwd, group, hosts, services
#

#	logfile			/var/log/nscd.log
#	threads			4
#	max-threads		32
#	server-user		nobody
#	stat-user		somebody
	debug-level		0
#	reload-count		5
	paranoia		no
#	restart-interval	3600

	enable-cache		passwd		yes
	positive-time-to-live	passwd		600
	negative-time-to-live	passwd		20
	suggested-size		passwd		211
	check-files		passwd		yes
	persistent		passwd		yes
	shared			passwd		yes
	max-db-size		passwd		33554432
	auto-propagate		passwd		yes

	enable-cache		group		yes
	positive-time-to-live	group		3600
	negative-time-to-live	group		60
	suggested-size		group		211
	check-files		group		yes
	persistent		group		yes
	shared			group		yes
	max-db-size		group		33554432
	auto-propagate		group		yes

	enable-cache		hosts		yes
	positive-time-to-live	hosts		3600
	negative-time-to-live	hosts		20
	suggested-size		hosts		211
	check-files		hosts		yes
	persistent		hosts		yes
	shared			hosts		yes
	max-db-size		hosts		33554432

	enable-cache		services	yes
	positive-time-to-live	services	28800
	negative-time-to-live	services	20
	suggested-size		services	211
	check-files		services	yes
	persistent		services	yes
	shared			services	yes
	max-db-size		services	33554432

	enable-cache		netgroup	yes
	positive-time-to-live	netgroup	28800
	negative-time-to-live	netgroup	20
	suggested-size		netgroup	211
	check-files		netgroup	yes
	persistent		netgroup	yes
	shared			netgroup	yes
	max-db-size		netgroup	33554432

Debian 下 ipv6 网络设置

CentOS 下的设置与 Debian 颇不同。目前不需要,也就不写了。

Debian 下设置示例如下:

vi /etc/network/interfaces

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto ens3
iface ens3 inet static
        address xxx.xxx.xxx.xxx
        netmask 255.255.254.0
        gateway xxx.xxx.xxx.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers xxx.xxx.xxx.10 xxx.xxx.xxx.11
        dns-search xxx.jp

iface ens3 inet6 static
        address 2001:xxxx:12
        netmask 64
        gateway xxxx::1
        dns-nameservers 2001:xxxx::2

设置完成后重启网络:

systemctl restart networking.service