编辑-自定义命令

vim ~/.bashrc example: alias codedir='cd /opt/local/www/project'

December 3, 2017 · 1 min · ZhaoGuibin

yum-y-install与yum-install有什么不同

yum -y install 包名(支持*) :自动选择y,全自动 yum install 包名(支持*) :手动选择y or n yum remove 包名(不支持*) rpm -ivh 包名(支持*):安装rpm包 rpm -e 包名(不支持*):卸载rpm包

December 3, 2017 · 1 min · ZhaoGuibin

windows下用navicat远程链接虚拟机Linux下MySQL数据库

手动增加可以远程访问数据库的用户。 方法一、本地登入mysql,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,将”localhost”改为”%” mysql -u root -proot mysql>use mysql; mysql>update user set host = '%' where user = 'root'; mysql>flush privileges; mysql>select host, user from user; 方法二、直接授权(推荐) 从任何主机上使用root用户,密码:youpassword(你的root密码)连接到mysql服务器: mysql -u root -proot mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION; mysql>flush privileges;

December 3, 2017 · 1 min · ZhaoGuibin

ss服务端安装libsodium支持chacha20

ss如果要使用 salsa20 或 chacha20 或 chacha20-ietf 算法,需要安装 libsodium ,否则就算在config.json里面设置成chacha20也会提示method not supported. centos: yum -y groupinstall "Development Tools" wget https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gztar xf libsodium-1.0.11.tar.gz && cd libsodium-1.0.11./configure && make -j2 && make install echo /usr/local/lib >/etc/ld.so.conf.d/usr_local_lib.confldconfig ubuntu/debian: apt-get install build-essential wget https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gztar xf libsodium-1.0.11.tar.gz && cd libsodium-1.0.11./configure && make -j2 && make installldconfig 如果曾经安装过旧版本,亦可重复用以上步骤更新到最新版,仅1.0.4或以上版本支持chacha20-ietf

December 3, 2017 · 1 min · ZhaoGuibin

ssh远程登录命令简单实例

ssh命令用于远程登录上Linux主机。 常用格式:ssh [-l login_name] [-p port] [user@]hostname 更详细的可以用ssh -h查看。 举例 不指定用户: ssh 192.168.0.11 指定用户: ssh -l root 192.168.0.11 ssh root@192.168.0.11 如果修改过ssh登录端口的可以: ssh -p 12333 192.168.0.11 ssh -l root -p 12333 216.230.230.114 ssh -p 12333 root@216.230.230.114 另外修改配置文件/etc/ssh/sshd_config,可以改ssh登录端口和禁止root登录。改端口可以防止被端口扫描。 编辑配置文件: vim /etc/ssh/sshd_config 找到#Port 22,去掉注释,修改成一个五位的端口: Port 12333 找到#PermitRootLogin yes,去掉注释,修改为: PermitRootLogin no 重启sshd服务: service sshd restart

December 3, 2017 · 1 min · ZhaoGuibin

php-fpm设置socket方式连接FastCGI

nginx和fastcgi的通信方式有两种,一种是TCP的方式,一种是unix socket方式。 socket方式不会走到tcp层,tcp方式则会走到ip层。因此,理论上说socket连接方式效率会更好一点。 TCP和unix domain socket方式对比 TCP是使用TCP端口连接127.0.0.1:9000 Socket是使用unix domain socket连接套接字/dev/shm/php-fpm.sock 修改php-fpm.conf配置 #listen = 127.0.0.1:9000 listen=/dev/shm/php-fpm.sock #/dev/shm/为内存文件系统,注意 确保可读写 listen.owner=apache #注意自己的用户和组 listen.group=apache 修改nginx.conf配置 #fastcgi_pass 127.0.0.1:9000; #将相应的如上内容修改如下 fastcgi_pass unix:/dev/shm/php-fpm.sock; 重启nginx和php-fpm service nginx restart /usr/local/nginx/sbin/nginx -s reload

December 3, 2017 · 1 min · ZhaoGuibin

PDO-MYSQL-make-pdo-mysql-lo-Error-1

编译安装PDO_MYSQL拓展模块,总是提示 In file included from /data0/software/PDO_MYSQL-1.0.2/pdo_mysql.c:31: /data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory In file included from /data0/software/PDO_MYSQL-1.0.2/pdo_mysql.c:31: /data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before ‘MYSQL’ /data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before ‘MYSQL_FIELD’ /data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:53: error: expected specifier-qualifier-list before ‘MYSQL_RES’ make: *** [pdo_mysql.lo] Error 1 这是因为这是因为在编译时需要 MySQL 的头的文件。而它按默认搜索找不到头文件的位置,所以才出现这个问题。通过软连接把MySQL头文件对应到/usr/local/include/下就好 比如你的MySQL安装文件位于/usr/local/mysql,那么就执行以下命令: ln -s /usr/local/mysql/include/* /usr/local/include/

December 3, 2017 · 1 min · ZhaoGuibin

NGINX-启动-warn-conflicting-server-name-“xxx-com”-on-0-0-0-0-80-ignored原因分析

报错如下: nginx: [warn] conflicting server name “www.xxx.com” on 0.0.0.0:80, ignored 域名重复配置所致

December 3, 2017 · 1 min · ZhaoGuibin

nginx配置location总结及rewrite规则写法

location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # 因为所有的地址都以 / 开头,所以这条规则将匹配到所有请求 # 但是正则和最长字符串会优先匹配 [ configuration B ] } location /documents/ { # 匹配任何以 /documents/ 开头的地址,匹配符合以后,还要继续往下搜索 # 只有后面的正则表达式没有匹配到时,这一条才会采用这一条 [ configuration C ] } location ~ /documents/Abc { # 匹配任何以 /documents/ 开头的地址,匹配符合以后,还要继续往下搜索 # 只有后面的正则表达式没有匹配到时,这一条才会采用这一条 [ configuration CC ] } location ^~ /images/ { # 匹配任何以 /images/ 开头的地址,匹配符合以后,停止往下搜索正则,采用这一条。 [ configuration D ] } location ~* \....

December 3, 2017 · 5 min · ZhaoGuibin

nginx-php-fpm出现502-bad-gateway错误解决方法

1.或者php-cgi端口和nginx配置不一致,这是比较低级的错误 2.php-fpm没有启动,到php-fpm所在目录启动 3.php-fpm配置文件user和group配置和Nginx不一致 4.在centos7中user和group修改在/opt/local/php/etc/php-fpm.d/www.conf里面

December 3, 2017 · 1 min · ZhaoGuibin