moooofly

Results 187 comments of moooofly

# [HTTP(S) Proxy in Golang in less than 100 lines of code](https://medium.com/@mlowicki/http-s-proxy-in-golang-in-less-than-100-lines-of-code-6a51c2f2c38c) > Oct 29, 2017 The goal is to implement a [proxy server](https://en.wikipedia.org/wiki/Proxy_server) for HTTP and HTTPS. Handling of...

# [Hop-by-hop headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#hbh) These headers are meaningful only for a single transport-level connection and must not be retransmitted by proxies or cached. Such headers are: `Connection`, `Keep-Alive`, `Proxy-Authenticate`, `Proxy-Authorization`, `TE`,...

# [Golang动手写一个Http Proxy](http://yangxikun.github.io/http/2017/09/16/http-proxy.html) > 16 September 2017 本文主要使用Golang实现一个可用但不够标准,**支持 basic authentication** 的http代理服务。 > **为何说不够标准?**在HTTP/1.1 RFC中,有些关于代理实现标准的条目在本文中不考虑。 ## Http Proxy 是如何代理我们的请求 Http 请求的代理如下图,Http Proxy只需要将接收到的请求转发给服务器,然后把服务器的响应,转发给客户端即可。 ![image](https://user-images.githubusercontent.com/7439290/51517534-0025aa80-1e56-11e9-9c5f-a7a7c31b8333.png) Https 请求的代理如下图,客户端首先需要发送一个Http CONNECT请求到Http Proxy,Http Proxy建立一条TCP连接到指定的服务器,然后响应200告诉客户端连接建立完成,之后客户端就可以与服务器进行SSL握手和传输加密的Http数据了。 ![image](https://user-images.githubusercontent.com/7439290/51517547-0e73c680-1e56-11e9-889e-2435c2835224.png) > **为何需要CONNECT请求?**...

# [Difference between Cron and Crontab?](https://stackoverflow.com/questions/21789148/difference-between-cron-and-crontab) - **cron** is the general name for the service that runs scheduled actions. - **crond** is the name of the daemon that runs in...

# [被遗忘的Logrotate](https://huoding.com/2013/04/21/246) ## 问题:sharedscripts的作用是什么? 大家可能注意到了,我在前面Nginx的例子里声明日志文件的时候用了星号通配符,也就是说这里可能涉及多个日志文件,比如:access.log和error.log。说到这里大家或许就明白了,sharedscripts的作用是在所有的日志文件都轮转完毕后统一执行一次脚本。如果没有配置这条指令,那么每个日志文件轮转完毕后都会执行一次脚本。 ## 问题:rotate和maxage的区别是什么? 它们都是用来控制保存多少日志文件的,区别在于rotate是以个数为单位的,而maxage是以天数为单位的。如果我们是以按天来轮转日志,那么二者的差别就不大了。 ## 问题:为什么生成日志的时间是凌晨四五点? 前面我们说过,Logrotate是基于CRON运行的,所以这个时间是由CRON控制的,具体可以查询CRON的配置文件「/etc/crontab」,可以手动改成如23:59等时间执行: ``` SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 59 23 * *...

# [使用logrotate管理nginx日志文件](https://www.do1618.com/archives/582/%E4%BD%BF%E7%94%A8logrotate%E7%AE%A1%E7%90%86nginx%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6/) 例如如果我们想对docker日志进行压缩和分割,则可以设置如下: ``` # Installs logrotate configuration files function setup-logrotate() { mkdir -p /etc/logrotate.d/ cat >/etc/logrotate.d/docker-containers /etc/logrotate.d/allvarlogs

# [运维中的日志切割操作梳理(Logrotate/python/shell脚本实现)](https://www.cnblogs.com/kevingrace/p/6307298.html) ## 其他重要参数说明 ``` compress 通过gzip 压缩转储以后的日志 nocompress 不做gzip压缩处理 copytruncate 用于还在打开中的日志文件,把当前日志备份并截断;是先拷贝再清空的方式,拷贝和清空之间有一个时间差,可能会丢失部分日志数据。 nocopytruncate 备份日志文件不过不截断 create mode owner group 轮转时指定创建新文件的属性,如create 0777 nobody nobody nocreate 不建立新的日志文件 delaycompress 和compress 一起使用时,转储的日志文件到下一次转储时才压缩 nodelaycompress 覆盖 delaycompress...

# 其他 ## 每1分钟切割一次 注意:日志里要有内容,因为前面定义空的日志文件是不切割的 ``` */1 * * * * /usr/sbin/logrotate -vf /etc/logrotate.d/tomcat >>/var/log/tomcat/oldlog/cutting.log ``` ## 每2小时切割一次 ``` 0 */2 * * * /usr/sbin/logrotate -vf /etc/logrotate.d/tomcat >> /root/chenjiaxin/cutting.log ```

# [如何在Ubuntu 16.04上使用Logrotate管理日志文件](https://cloud.tencent.com/developer/article/1172687)

# 通配证书 > ref: [How do I create my own wildcard certificate on Linux?](https://stackoverflow.com/questions/1822268/how-do-i-create-my-own-wildcard-certificate-on-linux) ## 需求 Does anyone know if it's possible to create my own wildcard certificate under Ubuntu?...