Hugh's Blog

WSL 文件权限问题

最近在 WSL 下碰到 PHP chmod(): Operation not permitted 这个问题,看起来是文件权限的问题,不过查看该文件的权限是 777,不知道是 Bug 还是什么原因导致的,Google 找了下,有 ...

 

PHP + Redis 简单消息队列

消息队列在高并发的时候,可以缓解对数据库的压力,下面使用 PHP + Redis(list) 简单模拟下这个过程。 $redis = new Redis(); $redis->connect('127.0.0.1', 6379); $type = isset($_GET['type']) ? 'read' : 'write'; switch ($type) { case 'write': // 随机获取内容,写入队 ...

 

Redis 有序集合使用

zset 是 Redis 的一种数据结构,为有序集合,每次插入新的值都会根据权重重新排序。 安装 sudo apt-get install redis-server # 安装 redis-server --daemonize yes # 后台启动 redis-cli # 进入命令行界面 使用 添加新值:za ...

 

Docker + Nginx 简单模拟负载均衡

只是简单的单机模拟负载均衡,做个记录。 建立相应的静态文件 mkdir html1 echo '<h1>Hello World 1</h1>' > ./html1/index.html # 同样的建立 html2, html3 建立 Nginx 配置文件 default.conf upstream app { server nginx1:80; server nginx2:80; server nginx3:80; } server { listen 80; server_name localhost; location / ...

Linux 搭建 Git 服务器

搭建 Git 服务器很简单,做个记录。 首先添加 git 用户并配置: sudo adduser git su git cd mkdir .ssh && chmod 700 .ssh touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys # 添加公钥到 authorized_keys,以便登录 ...

 
<< Newer Posts Older Posts >>