zhouquan 发布的文章

使用tzselect修改时区

[root@localhost ~]# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
 1) Africa
 2) Americas
 3) Antarctica
 4) Arctic Ocean
 5) Asia
 6) Atlantic Ocean
 7) Australia
 8) Europe
 9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
 1) Afghanistan           18) Israel                35) Palestine
 2) Armenia               19) Japan                 36) Philippines
 3) Azerbaijan            20) Jordan                37) Qatar
 4) Bahrain               21) Kazakhstan            38) Russia
 5) Bangladesh            22) Korea (North)         39) Saudi Arabia
 6) Bhutan                23) Korea (South)         40) Singapore
 7) Brunei                24) Kuwait                41) Sri Lanka
 8) Cambodia              25) Kyrgyzstan            42) Syria
 9) China                 26) Laos                  43) Taiwan
10) Cyprus                27) Lebanon               44) Tajikistan
11) East Timor            28) Macau                 45) Thailand
12) Georgia               29) Malaysia              46) Turkmenistan
13) Hong Kong             30) Mongolia              47) United Arab Emirates
14) India                 31) Myanmar (Burma)       48) Uzbekistan
15) Indonesia             32) Nepal                 49) Vietnam
16) Iran                  33) Oman                  50) Yemen
17) Iraq                  34) Pakistan
#? 9
Please select one of the following time zone regions.
1) east China - Beijing, Guangdong, Shanghai, etc.
2) Heilongjiang (except Mohe), Jilin
3) central China - Sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.
4) most of Tibet & Xinjiang
5) west Tibet & Xinjiang
#? 1

The following information has been given:

        China
        east China - Beijing, Guangdong, Shanghai, etc.

Therefore TZ='Asia/Shanghai' will be used.
Local time is now:      Tue Jul 19 22:05:59 CST 2016.
Universal Time is now:  Tue Jul 19 14:05:59 UTC 2016.
Is the above information OK?
1) Yes
2) No
#? yes
Please enter 1 for Yes, or 2 for No.
#? 1

You can make this change permanent for yourself by appending the line
        TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai

把 TZ='Asia/Shanghai'; export TZ 添加到 /etc/profile 文件中

source /etc/profile

问题描述

新版本的谷歌浏览器,会对 .dev 或者 .app 后缀的域名,在访问时强制跳转至https访问。
比如:你在谷歌浏览器中,访问 www.blog.dev 或者http://www.blog.dev 地址后,会强制跳转为 https://www.blog.dev
对于做 web 开发的人员来说,开发环境的服务器一般默认都是遵循 http 协议的,而不是 https 协议。这样,就导致我们无法用谷歌浏览器(新版QQ,360等浏览器都有这问题)进行测试。

- 阅读全部 -

Linux常见英文报错中文翻译(菜鸟必知)

1.command not found 命令没有找到

2.No such file or directory 没有这个文件或目录

3.Permission denied 权限不足

4.No space left on device 磁盘没有剩余空间

5.File exists 文件已经存在

6.Is a directory 这是1个目录

7.Not a directory 不是1个目录

8.Warning: Changing a readonly file 警告:改变一个只读文件

9.Found a swap file by the name ".1.swp" 发下了一个swap文件名字为1.swp

(vim编辑器碰到的意外关闭文件有缓存文件)

10.unrecognized option '--oldboy' 不识别的选项,去查看帮助

11.No route to host 没有路由到主机(防火墙没关)

12.connection refused 连接拒绝(防火墙没关或服务端口没开)

13.Access denied 访问拒绝(权限或者selinux)

转自:CSDN

redis是键值对的数据库,有5中主要数据类型:

字符串类型(string),散列类型(hash),列表类型(list),集合类型(set),有序集合类型(zset)

几个基本的命令:

KEYS * 获得当前数据库的所有键
EXISTS key [key ...] 判断键是否存在,返回个数,如果key有一样的也是叠加数
DEL key [key ...] 删除键,返回删除的个数
TYPE key 获取减值的数据类型(string,hash,list,set,zset)
FLUSHALL 清空所有数据库
CONFIG [get、set] redis配置
-inf 负无穷
+inf正无穷

- 阅读全部 -

1SQL运算符例子实际查询条件
eq=$map['id'] = array('eq',100);等效于:$map['id'] = 100;
neq!=$map['id'] = array('neq',100);id != 100
gt>$map['id'] = array('gt',100);id > 100
egt>=$map['id'] = array('egt',100);id >= 100
lt<$map['id'] = array('lt',100);id < 100
elt<=$map['id'] = array('elt',100);id <= 100
likelike$map['username'] = array('like','li%');username like 'li%'
betweenbetween and$map['id'] = array('between','1,8');id BETWEEN 1 AND 8
not betweennot between and$map['id'] = array('not between','1,8');id NOT BETWEEN 1 AND 8
inin$map['id'] = array('in','1,5,8');id in(1,5,8)
not innot in$map['id'] = array('not in','1,5,8');id not in(1,5,8)
and(默认)and$map['id'] = array(array('gt',1),array('lt',10));(id > 1) AND (id < 10)
oror$map['id'] = array(array('gt',3),array('lt',10), 'or');(id > 3) OR (id < 10)
xor(异或)xor两个输入中只有一个是true时,结果为true,否则为false,例子略。1 xor 1 = 0
exp综合表达式$map['id'] = array('exp','in(1,3,8)');$map['id'] = array('in','1,3,8');

注意:exp 不是一个运算符,而是一个综合表达式以支持更复杂的条件设置。exp 的操作条件不会被当成字符串,可以使用任何 SQL 支持的语法,包括使用函数和字段名称。

php自带函数file_exists判断文件是否存在,is_dir判断文件夹是否存在

如:

//当/www/index.php 都实际存在时
$file='index.php';
$dir='/www/';
if(file_exists($dir.$file)){
    echo '文件'.$file.'存在';
}else{
    echo '文件'.$file.'不存在';
}
if(is_dir($dir)){
    echo '目录'.$dir.'存在';
}else{
    echo '目录'.$dir.'不存在';
}

nginx配置

server {
    listen 80;
    server_name xx.com www.xx.com;
    index  index.html index.htm index.php;
    #access_log /var/log/nginx/xx.a.log;
    #error_log /var/log/nginx/xx.e.log;

    location ~ .*\.php(\/.*)*$ {
        root           /apps/www/bolg;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location / {
        root /apps/www/bolg;
        index index.php;
        if (-f $request_filename/index.html){
            rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
        if ($request_uri = / ){
            rewrite (.*) /index.php;
        }
    }

    location = / {
        rewrite (.*) /index.php;
    }

}

du [-abcDhHklmsSx] -L <符号连接>--block-size --max-depth=<目录层数>--version

常用参数:

a或-all 为每个指定文件显示磁盘使用情况,或者为目录中每个文件显示各自磁盘使用情况。
-b或-bytes 显示目录或文件大小时,以byte为单位。
-c或–total 除了显示目录或文件的大小外,同时也显示所有目录或文件的总和。
-D或–dereference-args 显示指定符号连接的源文件大小。
-h或–human-readable 以K,M,G为单位,提高信息的可读性。
-H或–si 与-h参数相同,但是K,M,G是以1000为换算单位,而不是以1024为换算单位。
-k或–kilobytes 以1024 bytes为单位。
-l或–count-links 重复计算硬件连接的文件。
-L<符号连接>或–dereference<符号连接> 显示选项中所指定符号连接的源文件大小。
-m或–megabytes 以1MB为单位。
-s或–summarize 仅显示总计,即当前目录的大小。
-S或–separate-dirs 显示每个目录的大小时,并不含其子目录的大小。
-x或–one-file-xystem 以一开始处理时的文件系统为准,若遇上其它不同的文件系统目录则略过。
-X<文件>或–exclude-from=<文件> 在<文件>指定目录或文件。
–exclude=<目录或文件> 略过指定的目录或文件。
–max-depth=<目录层数> 超过指定层数的目录后,予以忽略。
–help 显示帮助。
–version 显示版本信息。

- 阅读全部 -