二蛋 发布的文章

Html转义字符对照表

原始字符 entity 原始字符 entity
" " & &
' &#039; < &lt;
> &gt;   &nbsp;
¡ &iexcl; ¢ &cent;
£ &pound; ¤ &curren;
¥ &yen; ¦ &brvbar;
§ &sect; ¨ &uml;
© &copy; ª &ordf;
« &laquo; ¬ &not;
­ &shy; ® &reg;
¯ &macr; ° &deg;
± &plusmn; ² &sup2;
³ &sup3; ´ &acute;
µ &micro; &para;
· &middot; ¸ &cedil;
¹ &sup1; º &ordm;
» &raquo; ¼ &frac14;
½ &frac12; ¾ &frac34;
¿ &iquest; À &Agrave;
Á &Aacute; Â &Acirc;
à &Atilde; Ä &Auml;
Å &Aring; Æ &AElig;
Ç &Ccedil; È &Egrave;
É &Eacute; Ê &Ecirc;
Ë &Euml; Ì &Igrave;
Í &Iacute; Î &Icirc;
Ï &Iuml; Ð &ETH;
Ñ &Ntilde; Ò &Ograve;
Ó &Oacute; Ô &Ocirc;
Õ &Otilde; Ö &Ouml;
× &times; Ø &Oslash;
Ù &Ugrave; Ú &Uacute;
Û &Ucirc; Ü &Uuml;
Ý &Yacute; Þ &THORN;
ß &szlig; à &agrave;
á &aacute; â &acirc;
ã &atilde; ä &auml;
å &aring; æ &aelig;
ç &ccedil; è &egrave;
é &eacute; ê &ecirc;
ë &euml; ì &igrave;
í &iacute; î &icirc;
ï &iuml; ð &eth;
ñ &ntilde; ò &ograve;
ó &oacute; ô &ocirc;
õ &otilde; ö &ouml;
÷ &divide; ø &oslash;
ù &ugrave; ú &uacute;
û &ucirc; ü &uuml;
ý &yacute; þ &thorn;
ÿ &yuml; Œ &OElig;
œ &oelig; Š &Scaron;
š &scaron; Ÿ &Yuml;
ƒ &fnof; ˆ &circ;
˜ &tilde; Α &Alpha;
Β &Beta; Γ &Gamma;
Δ &Delta; Ε &Epsilon;
Ζ &Zeta; Η &Eta;
Θ &Theta; Ι &Iota;
Κ &Kappa; Λ &Lambda;
Μ &Mu; Ν &Nu;
Ξ &Xi; Ο &Omicron;
Π &Pi; Ρ &Rho;
Σ &Sigma; Τ &Tau;
Υ &Upsilon; Φ &Phi;
Χ &Chi; Ψ &Psi;
Ω &Omega; α &alpha;
β &beta; γ &gamma;
δ &delta; ε &epsilon;
ζ &zeta; η &eta;
θ &theta; ι &iota;
κ &kappa; λ &lambda;
μ &mu; ν &nu;
ξ &xi; ο &omicron;
π &pi; ρ &rho;
ς &sigmaf; σ &sigma;
τ &tau; υ &upsilon;
φ &phi; χ &chi;
ψ &psi; ω &omega;
ϑ &thetasym; ϒ &upsih;
ϖ &piv; &ensp;
&emsp; &thinsp;
&zwnj; &zwj;
&lrm; &rlm;
&ndash; &mdash;
&lsquo; &rsquo;
&sbquo; &ldquo;
&rdquo; &bdquo;
&dagger; &Dagger;
&bull; &hellip;
&permil; &prime;
&Prime; &lsaquo;
&rsaquo; &oline;
&frasl; &euro;
&image; &weierp;
&real; &trade;
&alefsym; &larr;
&uarr; &rarr;
&darr; &harr;
&crarr; &lArr;
&uArr; &rArr;
&dArr; &hArr;
&forall; &part;
&exist; &empty;
&nabla; &isin;
&notin; &ni;
&prod; &sum;
&minus; &lowast;
&radic; &prop;
&infin; &ang;
&and; &or;
&cap; &cup;
&int; &there4;
&sim; &cong;
&asymp; &ne;
&equiv; &le;
&ge; &sub;
&sup; &nsub;
&sube; &supe;
&oplus; &otimes;
&perp; &sdot;
&lceil; &rceil;
&lfloor; &rfloor;
&lang; &rang;
&loz; &spades;
&clubs; &hearts;
&diams;

Nginx设置严格域名校验

配置 HTTP/HTTPS 网站时,Nginx 默认不严格校验 Host/SNI 字段。也就是说,假如我们只配置了 server_name 2dan.cc www.2dan.cc,但用户使用 IP 地址访问,仍然会访问到这个网站(server);另外使用 https://IP 访问,再查看SSL证书,会泄露IP上绑定的域名。

解决:

一、配置默认 server

要解决问题很简单,我们用 default_server 设置默认服务器就行了。对于 HTTP 协议,可以这么写:

server {
    listen 80 default_server;
    return 444;
}

其中 444 是 Nginx 自定义的、非 HTTP 标准的状态码,表示关闭连接;写成 403 之类也没问题。server_name 省略不写。

HTTPS 类似,但需要 SSL 证书。可以用现成的证书,但其中会有域名等信息。如果介意,自签名一张就好。

要自签名证书,我们先生成私钥(任选其一):

openssl genrsa -out /opt/self-signed.key 2048 # 2048 位 RSA
openssl ecparam -name secp384r1 -genkey -out /opt/self-signed.key # 384 位 ECC

然后根据私钥生成证书:

openssl req -new -x509 -days 3650 -key /opt/self-signed.key -out /opt/self-signed.crt -subj "/C=CN/ST=NULL/L=NULL/O=NULL/OU=NULL/CN=Please-enable-SNI"

其中 3650 是有效期天数,这里是 10 年。Please-enable-SNI 就是通用名称(Common Name),一般这里就是主域名,但我们自签名可以随便写,反正不受信任,也不需要被浏览器信任。

- 阅读剩余部分 -

SeaCMS使用定时任务软件实现自动生成

使用定时任务软件访问以下网址即可:

生成首页链接:
你的网址/后台目录/admin_makehtml2.php?action=index&by=video&password=cookie加密码

生成列表页链接:
你的网址/后台目录/admin_makehtml2.php?action=allchannel&password=cookie加密码

生成当天更新内容页链接:
你的网址/后台目录/admin_makehtml2.php?action=daysview&password=cookie加密码

cookie加密码位置:
后台 系统 - 网站资料设置 - cookie加密码

CloudFlare使用api修改域名解析NS为第三方NS

官方文档 https://developers.cloudflare.com/api/operations/registrar-domains-update-domain

修改方法

curl --request PUT \
  --url https://api.cloudflare.com/client/v4/accounts/账户ID/registrar/domains/2dan.cc\
  --header 'Content-Type: application/json' \
  --header 'X-Auth-Email: [email protected]' \
  --header 'X-Auth-Key: xa3a22e7388ca555827e78e1e8hca7f22b280' \
  --data '{
  "auto_renew": true,
  "locked": false,
  "name_servers": [
    "mussel.dnspod.net",
    "crystal.dnspod.net"
  ],
  "privacy": true
}'

- 阅读剩余部分 -

Cloudflare使用api自由切换SSL证书颁发机构

介绍

Cloudflare目前Free计划提供四种证书
DigiCert CF默认签发的证书,兼容性更广,证书链也更短,只有一级中间证书,证书为期一年
Let’s Encrypt 证书为其三个月更换,有被墙的黑历史,慎用
Google Trust Services 其三个月更换
Sectigo 这个仅作为备份,不能主动启用,在控制台使用应该是随机分配的,没办法指定。

切换方法

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/你的域名区域ID/ssl/universal/settings" \
     -H "X-Auth-Email: 你的CF邮箱" \
     -H "X-Auth-Key: 你的APIKEY" \
     -H "Content-Type: application/json" \
     --data '{"enabled":true,"certificate_authority":"digicert"}'

- 阅读剩余部分 -