LinMinquan's Blog

Experience technology to change life

凌晨肚子痛去急诊

睡前就开始痛了,在肚脐的下方,不是胃,是肠子。可能是睡前气到了,且喝了罐汽水饮料。 以为睡一觉就会好。凌晨两点多痛醒,起来拉屎拉不出来,也不拉肚子。Miley去买了保济丸,吃了一小时后也没效果。就想去医院急诊了。 叫了救护车。很快就到了。问情况,量血压,血氧。 到医院的时候应该已经是4点半了。医生判断可能是肠抽筋(肠痉挛?)。打了一针,过了一个小时还没好。再打一针,并喝了个白色液体,吃药。再过了一段时间,上了厕所拉屎后就好了一大半。期间还抽血检查,验尿。 7点半就出院了。 Read more →

Shopify Analytics 和 Google Analytics 数据不一样

Shopify 后台配置好了 Google Analytics,并在 Shopify 后台和 Google Analytics 后台都开启了 Enhanced Ecommerce 时,两边的订单数(Transactions)和总销售额(Revenue)是不一样,当然 Conversion Rate 也会不一样。 看下面两个参考链接,就会知道为什么会不一样。以及有哪些可以使得数据更接近一些办法。 参考链接: Discrepancies between Shopify and other software Discrepancy between GA and Shopify sales Read more →

升级 Nginx 编译时 OpenSSL 版本的问题

环境: Ubuntu: 18.04.4 Nginx: 1.16.1 当 Ubuntu 版本是 16.04 时,同事把 Nginx 版本升到 1.16.1,然后再把 Ubuntu 升到 18.04.4 照理说 Nginx 的 1.16.1 版本,是应该有 TLS 1.3 的,但不知道为什么就是开启不了 TLS 1.3,一直是 TLS 1.2。 升级后的 Ubuntu 18.04.4 里的 OpenSSL 版本倒是对的,见下图。 后来才发现用 nginx -V 可以看出来 Nginx build 时的 OpenSSL 的版本,注意 V 是大写的。 然后就是 Nginx built with 的 OpenSSL 版本还是低版本的。 我们的目标是开启 TLS 1.3,现在一直是 TLS 1.2。 想要通过其它的办法来弄,都没弄成功。最后解决办法是从另一台 Ubuntu 18.04 服务器上拷了 nginx 过来用,这台 Ubuntu 刚开的时候就是 18.04。nginx 的文件在 /usr/sbin/nginx 拷过来时,nginx 文件的权限要重新设置一下。最后要重启下 nginx 的 server,sudo service nginx restart。 Read more →

怎样在 SSL Labs 上得到 A+ 的分数

环境: Ubuntu: 18.04.4 Nginx: 1.16.1 TLS 1.2 和 TLS 1.3 得 enable,去掉 weak cipher。 证书用 acme.sh 生成的 let’s encrypt wildcard 证书。 如下为 Nginx 配置: ssl_certificate /path-of-certificate/fullchain.cer; ssl_certificate_key /path-of-certificate/xxxx.key; # Enable TLSv1.2 And TLS1.3 Only ssl_protocols TLSv1.2 TLSv1.3; # Enable Modern TLS Cipher Suites(No Weak) ssl_ciphers 'TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256'; # Server Cipher Order Required ssl_prefer_server_ciphers on; # Enable SSL Stapling ssl_stapling on; ssl_stapling_verify on; # Add HSTS Header With Preload. Forces Clients To Remember The Server Has SSL And Use It #add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; add_header Strict-Transport-Security "max-age=63072000; preload"; Read more →

install PyCrypto on Windows

Environment: Python 2.7 My default python environment is python 3.4, and I create a Virtualenv of python 2.7, when I try to install PyCrypto, it return some error. I google and get a answer, I need to install prebuild binaries of PyCrypto, below is the page with those binaries for windows http://www.voidspace.org.uk/python/modules.shtml#pycrypto what I learned is to install in virtualenv  Reference: https://stackoverflow.com/questions/11405549/how-do-i-install-pycrypto-on-windows Read more →

using rsync in windows 10

I just want to upload web static files to server, after some search, it looks like rsync can work on windows but needed to install something(Cygwin or cwRsync) at first. I check rsync command on Ubuntu (windows subsystem for linux), it worked. So, I think the easiest way to use rsync on windows 10. Read more →

Hugo add meta for Facebook and Twitter share link preview

After analyze a example link that can preview in Facebook & Twitter and search Google, I found it just need to add some meta on blog post’s html header. One guy give an example code below. His blog post about this solution: https://vietlq.github.io/2017/04/30/access-hugo-page-variables/His github gist about this code: https://gist.github.com/vietlq/d1c7ecfb20ce7beac4a7f4df746c797cReference: <a rel=“noreferrer noopener” aria-label=“Reference: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary.html https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/markup.html  (opens in a new tab)” href=“https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary.html" target="_blank”>https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary.html<a rel=“noreferrer noopener” aria-label=“Reference: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary.html https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/markup.html  (opens in a new tab)” href=“https://developer. Read more →

AWS EC2 搭的网站无法访问

环境:AWS EC2, Ubuntu 16.04 64 bit 用的是 AWS 免费试用的 EC2,在上面搭 Discourse 测试,感觉搭好了怎么老是访问不了。才搜到原来得在AWS 后台打开对应的端口,它默认只开22端口用来ssh,然后我开了80端口。 Services > EC2 > NETWORK & SECURITY > Security Groups > 选中你的VPC > Inbound 然后过了两三天,我在上面给 Discourse + Nginx + 其它网站 + Cerbot 配 https,感觉 Cerbot 配好了呀,安装好后就一个命令呀,怎么 https 打不开,以为是 Cerbot的问题,倒腾了半天,吃过一顿午饭后才想起来是 AWS 的锅,赶紧把 443加上,OK了。 Read more →

Discourse 邮件 G Suite 配置

环境:AWS EC2, Discourse v2.2.0.beta3, Ubuntu 16.04 64bit 之前的同事用的是公司G Suite的某个邮箱配置的。 但我用同样的邮件配置,在另一台AWS EC2上配置,却一直发不出邮件。看Discourse log, 我试着用腾讯企业邮箱,也发不出来,我记得是类似的错误,但参考了下面的教程后,报错不一样了,但我没有接着试,我转试 mailgun 使用腾讯企业邮箱配置 Discourse 邮件发送服务器discourse+Ubuntu安装详解mailgun 注册时,可以不马上绑定付款方式,配置自己的域名,然后授权的收件人(recipient),就可以发测试邮件了。mailgun 是可以正常发邮件的,而且可以在mailgun 后台看到 log,来查看邮件是否发送成功以及发送失败的原因。 后来才注意到 smtp-relay.gmail.com 这个url 有点奇怪,别人用的都是 smtp.gmail.com ,我试了用 smtp.gmail.com 后就正常了,可以发邮件了。 可 smtp-relay.gmail.com 是什么特别的服务器吗?原来这个 G Suit 专门给只发送邮件的使用场景用的服务器, Send email from a printer, scanner, or app https://support.google.com/a/answer/176600?hl=en配置的话,要登录 G Suite Admin Console,界面是如下图所示 上图 Apps > G Suite > Gmail > Advanced settings > General Settings > SMTP relay service 就会发现我同事设置了限定发送邮件的服务器的IP地址,且只能是从跟这个G Suit一样的子域名(我习惯拿自己域名测试)才可以发送,我加上了我EC2的IP,又弄了个公司域名的子域名。要注意的是,修改后,要点击保存。 Mail send from these IP addresses will be trusted as coming from your domains. Read more →