CDN是什么
A content delivery network or content distribution network (CDN) is a geographically distributed network of proxy servers and their data centers. The goal is to distribute service spatially relative to end-users to provide high availability a...
原因
在Nginx端配置Google-Analytics和在HTML中加载Google-Analytics有几个显著的有点,
杜绝用户到Google Analytics之间的网络问题,特别是国内(尽管已经解析到Google在北京的服务器)
防止adblock这样的软件屏蔽
提升页面加载速度
配置方法
nginx 配置 server 块内加入以下内容
userid on;
userid_name cid;
userid_domain moonagic.com;
userid_path ...
2018年2月20日发布的NGINX 1.13.9开始支持HTTP/2服务器推送功能.
HTTP/2规范中定义的服务器推送允许服务器抢先将资源推送到远程客户端,预计客户端可能很快会请求这些资源.通过这样做,您可以在页面加载操作中将RTT(往返时间 - 请求和响应所需的时间)减少一个RTT或更多,从而为用户提供更快的响应.
配置HTTP/2 server push
server {
# Ensure that HTTP/2 is enabled for the server
list...
Nginx主线分支从1.13.0版本开始支持TLS1.3,只需要在编译的时候选择使用OpenSSL支持TLS1.3的分支进行编译即可.
使用对应的OpenSSL分支进行编译
# OpenSSL对TLS1.3的支持已经到了draft19,不过Chrome和Firefox对TLS1.3的支持还在draft18
git clone -b tls1.3-draft-18 --single-branch https://github.com/openssl/openssl.git openssl
然后在预编...
安装一些必要的工具
apt-get install build-essential libpcre3 libpcre3-dev zlib1g-dev
下载需要的源代码
# Openssl版本需要1.0.2才能支持ALPN,而后者是新版Chrome支持HTTP/2的必要条件
wget -O openssl.zip -c https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz
unzip openssl.zip
mv openss...
Install LetsEncrypt Client
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
Obtain a Certificate
Inside the nginx config, add this location block:
location ~ /\.well-known/acme-challenge {
root /var/www/html;
}
Reload ...