技术文章
Linux 命令行输入的命令的操作技巧
ctrl + r //可以在历史的命令中搜索 ctrl + a //光标移到命令行的开始位置 ctrl + e //光标移到命令行的结束位置 ctrl + f //光标向前移动 ctrl + b //光标向后移动 ctrl + u //清除当前命令行 ctrl + c //直接转到下一行
CentOS 报错:yum-config-manager: 未找到命令
这是因为系统默认没有安装这个命令,这个命令在
yum-utils
包里,可以通过命令yum -y install yum-utils
安装就可以了。FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
错误原因及解决方法:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
而 Nginx 识别不到
/scripts
路径,所以phpinfo
验证信息就无法正常通过,需要修改如下:fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
注意:
$document_root
代表当前请求在root
指令中指定的值。CentOS 服务器搭建 Shadowsockets 教程
yum install python-setuptools m2crypto supervisor easy_install pip pip install shadowsocks
/usr/bin/python /usr/bin/ssserver -p 443 -k yourpassword -m aes-256-cfb --user nobody -d start
解决错误:nginx: [emerg] unknown log format "main"
重启 nginx 出现了如下错误:
nginx: [emerg] unknown log format "main" in /usr/local/nginx/conf/nginx.conf:34
解决办法:
打开
nginx.conf
,"main" 错误是因为丢失了log_format
选项,把log_format
所在行的注释去掉就 OK 了。Windows 修改 Caps Lock 为 Control 键
保存以下内容到
ChangeCapsToControl.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
双击替换成功!
关于 phpMyAdmin 免输入用户名和密码,直接进入管理界面
下载最新版的phpMyAdmin包,解压到网站根目录,进入phpMyAdmin的目录找到libraries下面的config.default.php文件,打开,可以看见大大的[DO NOT EDIT]字样,哈哈,我就是要DO IT!!!!
图片延迟加载技术(ImageLazyLoad)
ImageLazyLoad 技术,就是在下拉滚动条的时候加载图片,这种比较适合一个网页上有很多图片的情况,例如某个页面都是图片,那么如果用户访问的时候,会在加载完整个页面等待很长时间,而用第一眼看到的只是第一屏的内容,所以第二屏、第三屏等的内容加载时间其实是在浪费时间!
.gitignore 添加后无效的解决办法
我们在项目中经常会出现
.gitignore
修改后并没有忽略掉我们已经添加的文件,那是因为.gitignore
对已经追踪 (track) 的文件是无效的,需要清除缓存,清除缓存后文件将以未追踪的形式出现,这时重新添加 (add) 并提交 (commit) 就可以了。// 不要忘了后面的 . git rm -r --cached . git add . git commit -m "comment"
composer 版本号 ~ 与 ^ 符号的区别
~1.2.3
即1.2.3 <= version < 1.3.0
^1.2.3
即1.2.3 <= version < 2.0.0
Linux 的 chattr 与 lsattr 命令详解
chattr命令的用法:chattr [ -RVf ] [ -v version ] [ mode ] files… 最关键的是在[mode]部分,[mode]部分是由+-=和[ASacDdIijsTtu]这些字符组合的,这部分是用来控制文件的 属性。
+ :在原有参数设定基础上,追加参数。 - :在原有参数设定基础上,移除参数。 = :更新为指定参数设定。 A:文件或目录的 atime (access time)不可被修改(modified), 可以有效预防例如手提电脑磁盘I/O错误的发生。 S:硬盘I/O同步选项,功能类似sync。 a:即append,设定该参数后,只能向文件中添加数据,而不能删除,多用于服务器日志文件安全,只有root才能设定这个属性。 c:即compresse,设定文件是否经压缩后再存储。读取时需要经过自动解压操作。 d:即no dump,设定文件不能成为dump程序的备份目标。 i:设定文件不能被删除、改名、设定链接关系,同时不能写入或新增内容。i参数对于文件 系统的安全设置有很大帮助。 j:即journal,设定此参数使得当通过mount参数:data=ordered 或者 data=writeback 挂 载的文件系统,文件在写入时会先被记录(在journal中)。如果filesystem被设定参数为 data=journal,则该参数自动失效。 s:保密性地删除文件或目录,即硬盘空间被全部收回。 u:与s相反,当设定为u时,数据内容其实还存在磁盘中,可以用于undeletion。
各参数选项中常用到的是a和i。a选项强制只可添加不可删除,多用于日志系统的安全设定。而i是更为严格的安全设定,只有superuser (root) 或具有CAP_LINUX_IMMUTABLE处理能力(标识)的进程能够施加该选项。
Linux 中命令执行控制 && 与 || 的区别
1、&& 方式:command1 && command2 如果command1执行成功,则执行command2
2、|| 方式:command1 || command2 如果command1执行失败,则执行command2
PHP 5.4 的新特性
- 命名空间 (Namespace)
- 匿名函数
- 数组短语法形式:
[1,2,3]
取代array(1,2,3)
。这在多维数组、嵌套数组中,代码更清晰、简短。 - 在视图文件中使用 PHP 的
<?=
标签,取代echo
语句。 - 标准PHP库 (SPL) 类和接口,具体可以查看 SPL Class and Interface
- 延迟静态绑定, 具体可以查看 Late Static Bindings
- PHP 标准日期时间
- 特质 (Traits)
- 使用 PHP intl 扩展实现国际化支持
网页禁止右键和复制
<SCRIPT LANGUAGE=javascript> function click() { alert('Forbidden') } function mdown() { if (event.button==2) {alert('Forbidden') }} function CtrlKeyDown(){ if (event.ctrlKey) {alert('Forbidden') }} document.onkeydown=CtrlKeyDown; document.onselectstart=click; document.onmousedown=mdown; </SCRIPT>
Nginx 使用 htpasswd 生成密码认证
安装 httpd-tools
yum install -y httpd-tools
htpasswd 命令需要先安装 httpd-tools
修改 nginx.conf
# xxx.cuiliang.com server { listen 80; server_name xxx.cuiliang.com; auth_basic "密码提示语"; auth_basic_user_file /usr/local/nginx/conf/htpasswd.users; location / { //... } }
使用 htpasswd 生成密码
htpasswd -b /usr/local/nginx/conf/htpasswd.users
输入密码,再次确认密码,提示成功,OK!
重启 nginx
/usr/local/nginx/sbin/nginx -s reload
重启生效
WordPress 如何控制每页显示的条数
进入 wordpress 后台 设置 > 阅读 > 修改博客页面最多显示几篇文章 Feeds 同步最新几篇文章 在这里修改就可以了!
Yii Framework 应用通过 UCenter 整合 discuz 视频教程
这一讲主要讲了 Yii 应用和 discuz 通过 UCenter 实现了双向同步,有些代码写的也不是很严密,我只是给大家起个抛砖引玉的作用,大家如果有什么好的建议,欢迎讨论。提供程序源码及高清视频下载地址:
PHP 比较两个数组的值是否相等
function compareArray() { $arr1 = array('a', 'b', 'c', 'd'); $arr2 = array('d', 'c', 'b', 'a'); sort($arr1); sort($arr2); return $arr1 == $arr2; }
Linux 中 grep 命令实现“或”条件
\| 符号法
# grep 'cui\|liang'
使用多个 -e 参数
# grep -e cui -e liang
使用扩展 -E
# grep -E "cui|liang"
CentOS 中 yum update 与 yum upgrade 的区别
在 CentOS 系统中,
yum upgrade
与yum update
都会将系统包更新到最新版本。通过
man yum
查询到的帮助信息如下:update
If run without any packages, update will update every currently installed package. If one or more packages or package globs are specified, Yum will only update the listed packages. While updating packages, yum will ensure that all dependencies are satisfied. (See Specifying package names for more information) If the packages or globs specified match to packages which are not currently installed then update will not install them. update oper- ates on groups, files, provides and filelists just like the "install" command. If the main obsoletes configure option is true (default) or the --obsoletes flag is present yum will include package obsoletes in its calculations - this makes it better for distro-version changes, for example: upgrading from somelinux 8.0 to somelinux 9. Note that "update" works on installed packages first, and only if there are no matches does it look for available packages. The difference is most noticeable when you do "update foo-1-2" which will act exactly as "update foo" if foo-1-2 is installed. You can use the "update-to" if you’d prefer that nothing happen in the above case.
upgrade
Is the same as the update command with the --obsoletes flag set. See update for more details.
唯一不同是:
yum upgrade
会删除旧版本的package
,而yum update
则会保留。注意!如果你的某些软件依赖旧版本的package
,请使用yum update
。
文章归档
文章日历
2025 年 07 月 | ||||||
---|---|---|---|---|---|---|
日 | 一 | 二 | 三 | 四 | 五 | 六 |
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
文章标签
- Linux
- Go
- Yii
- 新浪
- CentOS
- PHP
- Git
- WSL
- Composer
- Mac
- 入职
- Bootstrap
- pyenv
- UCenter
- 厦门
- 出差
- 长沙
- 湖南卫视
- 微博
- Tengine
- YUI
- 泰国
- pecl
- 优化
- GitLab
- 迁移
- rootless
- 年会
- 生日
- Tengin
- RedHat
- Sphinx
- cygwin
- Windows
- Tmux
- Zsh
- 升级
- MySQL
- sql_mode
- Shadowsockets
- 面向对象
- HTTP
- 状态码
- grep
- unoconv
- PPT
- Nginx
- htpasswd
- golang
最新评论
-
崔亮 于 19-05-23 评论了Tengine 2.2.2 配置 http2 协议出现的坑
-
王媛 于 19-01-31 评论了Yii China 是官方唯一认可的中文社区
-
三杯蛙 于 19-01-24 评论了Go 语言中 json 的操作以及常见问题
-
三杯蛙 于 19-01-24 评论了新浪赴泰国曼谷和芭提雅团建
-
巡洋舰 于 18-09-05 评论了CentOS 安装 PHP7
-
小不点 于 11-03-02 评论了WordPress 如何控制每页显示的条数
-
白领厕工 于 10-12-22 评论了关于 phpMyAdmin 免输入用户名和密码,直接进入管理界面
-
清晨的欣赏 于 10-08-04 评论了PHP 5.4 的新特性
-
易赛官网 于 10-07-27 评论了PHP 5.4 的新特性
-
文秘之家 于 10-07-17 评论了PHP 5.4 的新特性
常用工具
- 时间戳转换
- URL ENCODE/DECODE
- JSON
- 正则测试