form1.cn
Make a little progress every day
14th of August 2018 Linux GIT 2265

git找回本地误删的文件

不小心把本地的文件删除了一个?想从仓库gitpull下拉?对不起,这是不行的,虽然不知道为什么,但是我告诉你怎么回复这个文件。首先,我们先用gitstatus看看工作区的变化$gitstatusOnbranchdevYourbranchisup-to-datewith'origin/dev'.Changestobecommitted:(use"gitresetHEAD<file>..."tounstage)deleted:Ap...
13th of July 2018 Linux Command 2145

Linux后台运行的几种方法

第一种:使用“nohup”,即"nohup./test.sh&",忽略hangup信号,防止终端关闭时程序退出。运行状态可以用“jobs-l”来查看。第二种:使用“setsid”即“setsid./test.sh”。第三种:最简单,将命令放入括号当中,比如说:(./test&),这样就行了。
28th of May 2018 Linux Command 2424

linux使用crontab自动备份mysql

服务器是阿里的ECS,装了mysql,mysql执行文件目录:/usr/local/mysql/bin/,实现自动备份mysql步骤如下:1,在服务器/usr/bin目录下创建文件mysqlbak,并写入以下脚本#!/bin/bashnowdate="/datafile/mysqlbak/"`date+%Y%m%d`".sql"/usr/local/mysql/bin/mysqldumpyoudatabase>"$nowdate"以下脚本会运行mysql...
22th of May 2018 Linux GIT 2425

git忽略已经提交推送的文件

有时候我们添加.gitignore文件之前已经提交过了文件。.gitignore只能忽略那些原来没有被track的文件(自添加以后,从未add及commit过的文件),如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。就需要执行:gitrm-r--cached.#这是里删除追踪状态的文件或目录gitadd.gitcommit-m"fixeduntracke...
02th of May 2018 Linux GIT 2921

git设置不需要输入密码

https方式每次都要输入密码,按照如下设置即可输入一次就不用再手输入密码的困扰而且又享受https带来的极速设置记住密码(默认15分钟):gitconfig--globalcredential.helpercache如果想自己设置时间,可以这样做:gitconfigcredential.helper'cache--timeout=3600'这样就设置一个小时之后失效长期存储密码:...
25th of April 2018 Linux Command 4894

lnmp1.4一键包安装php7.1扩展gmp

lnmp这个不用多说,现在很多企业都在用,很方便,还支持升级降级安装地址在这里:https://lnmp.org/install.html只要是lnmp中php\ext中有的扩展都可以通过该方法安装当你安装lnmp后发现没有gmp扩展时可以参考以下方法进行安装进入lnmp中src目录cd/root/lnmp1.4/src里面有个php-7.1.7.tar.bz2压缩包,解压tar-...
20th of April 2018 Linux Command 2818

ContOS7中Let's Encrypt永久免费SSL证书教程

Let'sEncrypt免费SSL证书的出现,也会对传统提供付费SSL证书服务的商家有不小的打击。到目前为止,Let'sEncrypt获得IdenTrust交叉签名,这就是说可以应用且支持包括FireFox、Chrome在内的主流浏览器的兼容和支持,虽然目前是公测阶段,但是也有不少的用户在自有网站项目中正式使用起来。虽然目前Let'sEncrypt...
19th of April 2018 Linux Command 5050

CentOS使用remove和rpm删除安装的软件包

以mysql举例:首先查询安装包:rpm-qa|grepmysql查询到的一个结果为:mysql-community-libs-5.7.13-1.el6.x86_64yum删除yum-yremovemysql-community-libs-5.7.13-1.el6.x86_64rpm删除(仅用"-e"判断依赖)rpm-emysql-community-libs-5.7.13-1.el6.x86_64
19th of April 2018 Linux Command 3940

centos7.X安装与使用composer.phar

注:composer.phar与composer是一个东西,本文安装使用composer.phar//下载安装脚本-composer-setup.php-到当前目录php-r"copy('https://install.phpcomposer.com/installer','composer-setup.php');"//执行安装过程。phpcomposer-setup.php//删除安装脚本php-r"unlink('composer-setup.php');"//在php程序...
09th of April 2018 Linux GIT 4760

Git:代码冲突常见解决方法

如果系统中有一些配置文件在服务器上做了配置修改,然后后续开发又新添加一些配置项的时候,在发布这个配置文件的时候,会发生代码冲突:error:Yourlocalchangestothefollowingfileswouldbeoverwrittenbymerge:protected/config/main.phpPlease,commityourchangesorstashthembeforeyoucanmerge.如果希望保留生产...
16th of March 2018 Linux GIT 4314

id_rsa.pub的作用和获取id_rsa.pub

SSH在正式说id_rsa.pub之前有必要先说说SSH,具体什么意思就自己查资料了。一般我们都会使用到两种方式去登陆SSH,密码登陆和证书登陆。如果使用密码登陆,很有可能会遭受恶意攻击,所以在实际的工作中和大多数的互联网公司,都是会使用证书去登陆的。mac系统已开始就已经为我们安装了SSH了,如果没有安装的...
07th of January 2018 Linux Apache 2456

使用apache中的ab测试工具进行并发负载压力测试

性能测试工具目前最常见的有以下几种:ab、http_load、webbench、siege。今天我们专门来介绍ab。ab是apache自带的压力测试工具。ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试。比如nginx、tomcat、IIS等。ab的原理ab是apachebench命令的缩写。ab的原...
05th of January 2018 Linux Command 14190

CentOS查看内网IP和外网IP

有时候登录CentOS服务器后有查看内网可外网IP的需求,执行以下命令:查看内网IP地址,和window中cmd的ipconfig类似:ifconfig-a输出结果:eth0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu1500inet10.29.100.1netmask255.255.252.0broadcast10.29.103.255ether00:16:3e:05:5f:5ftxqueuelen1000(Ethernet)...
05th of January 2018 Linux Nginx 4566

nginx中的proxy_next_upstream容错处理

语法:proxy_next_upstreamerror|timeout|invalid_header|http_500|http_502|http_503|http_504|http_403|http_404|non_idempotent|off...;默认:proxy_next_upstreamerrortimeout;上下文:http,server,location指定请求应传递到下一个服务器的情况:error:在与服务器建立连接,向其传递请求或读取响应标头时发...
29th of October 2017 Linux Command 3358

免费90天的SSL(https)证书

注:有效期只有90天,可以续期:用第一次申请的key和crt进行续期,最后会生成一个新的domain-crt,将该文件更新到服务器即可https://zerossl.com申请免费SSL证书步骤的详细介绍:一、登录https://zerossl.com,点击“ONLINETOOLS"按钮,选择在线方式申请免费SSL证书。第一步、登录https://zerossl.com,选择...
11th of October 2017 Linux Command 3719

Centos6.9 配置使用SFTP服务器

众所周知SFTP账号是基于SSH账号的,所以在默认情况下访问服务器的权限是非常大的。下面为SFTP用户权限设置方法在Centos6.9环境使用系统自带的internal-sftp搭建SFTP服务器。注:SFTP和FTP是不同的服务器,不要混淆打开命令终端窗口,按以下步骤操作。0、查看openssh的版本ssh-V使用ssh-V命令来查看openssh的...
13th of September 2017 Linux Command 2225

linux命令useradd添加用户详解

1.作用useradd或adduser命令用来建立用户帐号和创建用户的起始目录,使用权限是超级用户。2.格式useradd[-dhome][-sshell][-ccomment][-m[-ktemplate]][-finactive][-eexpire][-ppasswd][-r]name3.主要参数-c:加上备注文字,备注文字保存在passwd的备注栏中。-d:指定用户登入时的主目录,替换系统默认值/ho...
12th of September 2017 Linux Command 2164

linux系统下安装两个或多个tomcat

编辑环境变量:vim/etc/profile加入以下代码(tomcat路径要配置自己实际的tomcat安装目录)##########firsttomcat###########CATALINA_BASE=/datafile/apache-tomcat-8.5.20-zjwlgrCATALINA_HOME=/datafile/apache-tomcat-8.5.20-zjwlgrTOMCAT_HOME=/datafile/apache-tomcat-8.5.20-zjwlgrexportCATALINA_BASEC...
11th of September 2017 Linux Command 3199

Centos7 关闭防火墙与放行3306

CentOS7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下1、直接关闭防火墙systemctlstopfirewalld.service#停止firewallsystemctldisablefirewalld.service#禁止firewall开机启动2、设置iptablesserviceyum-yinstalliptables-services如果要修改防火墙配置,如增加防火墙端口3306vi/etc/sys...
30th of August 2017 Linux Command 2234

Linux中crontab系统定时任务配置方法

1、crond服务管理与访问控制servicecrondrestart#启动cron服务chkconfigcrondon#开启cron自启动注:ubuntu为cron没有d如下:servicecronrestart2、用户的crontab设置crontab[选项]选项:-e:编辑crontab定时任务-l:查询crontab任务-r:删除当前用户所有的crontab任务例子:crontab-e#进入crontab编辑界面。...
17th of July 2017 Linux GIT 2157

IntelliJ IDEA使用git进行项目基本管理

第一部分:安装1.下载地址:https://git-scm.com/download/win;如果速度慢,使用迅雷下载;2.点击安装,然后下一步,直到下面这个页面:建议:按照上面所示方式选中复选框;3点击下一步,直到出现这个页面:建议:这个页面是选择git使用的命令行,建议使用第一个git自带的;4.点击下一步,直到出现下面这个页面:建议:这个是...
17th of July 2017 Linux GIT 1781

Git常用命令整理

gitinit在本地新建一个repo,进入一个项目目录,执行gitinit,会初始化一个repo,并在当前文件夹下创建一个.git文件夹.gitclone获取一个url对应的远程Gitrepo,创建一个localcopy.一般的格式是gitclone[url].clone下来的repo会以url最后一个斜线后面的名称命名,创建一个文件夹,如果想要指定特定的名称,可以gitclon...
13th of June 2017 Linux Command 2213

CPU状态信息us,sy,ni,id,wa,hi,si,st含义

使用系统命令top即可看到如下类似信息:Cpu(s):0.0%us,0.5%sy,0.0%ni,99.5%id,0.0%wa,0.0%hi,0.0%si,0.0%stItrytoexplainthese:us:ismeaningof"userCPUtime"sy:ismeaningof"systemCPUtime"ni:ismeaningof"niceCPUtime"id:ismeaningof"idle"wa:ismeaningof"iowait"hi:ismeaningof"hardwareirq"si:ismeaningof...
02th of April 2017 Linux Apache 2125

重启Mac上的Apache服务命令

这个命令很早以前就查过了,但是每次使用的时候还是要在网上查:停止服务:sudo/usr/sbin/apachectlstop开启服务:sudo/usr/sbin/apachectlstart重启服务:sudo/usr/sbin/apachectlrestart
24th of March 2017 Linux Memcached 1862

PHP调用memcached与常用操作

PHP连接memcached<?php$memcache=newMemcache;//创建一个memcache对象$memcache->connect('localhost',11211)ordie("Couldnotconnect");//连接Memcached服务器$memcache->set('key','test');//设置一个变量到内存中,名称是key值是test$get_value=$memcache->get('key');//从内存中取出key的值echo$get_value...
24th of March 2017 Linux Memcached 1945

Memcached是什么?Memcached介绍

Memcached是一个自由开源的,高性能,分布式内存对象缓存系统。Memcached是以LiveJournal旗下DangaInteractive公司的BradFitzpatric为首开发的一款软件。现在已成为mixi、hatena、Facebook、Vox、LiveJournal等众多服务中提高Web应用扩展性的重要因素。Memcached是一种基于内存的key-value存储,用来存储小块...
08th of March 2017 Linux Sphinx 2150

Sphinx+PHP扩展方式简单配置与使用

复制默认配置文件,重新创建一个配置文件sphinx.conf.dist是完整版默认配置,有很多内容,我这里选择复制的是sphinx-min.conf.dist迷你版,只要满足基本查询需要即可#cp/usr/local/sphinx/etc/sphinx-min.conf.dist/usr/local/sphinx/etc/sphinx.confsphinx.conf文件的配置说明##MinimalSphinxconfigurations...
07th of March 2017 Linux Sphinx 2459

Linux中php安装SCWS扩展

进入源码目录的phpext/目录#cd/scws-1.2.3/phpext#/usr/local/php/bin/phpize#用phpize生成configure配置文件#./configure--with-php-config=/usr/local/php5/bin/php-config--with-scws=/usr/local/scwsphpext//configure操作#make#makeinstallInstallingsharedextensions:/usr/local/php5/lib/php/extensio...
07th of March 2017 Linux Sphinx 2312

Linux编译安装SCWS中文分词系统

简介SCWS是SimpleChineseWordSegmentation的首字母缩写(即:简易中文分词系统)。这是一套基于词频词典的机械式中文分词引擎,它能将一整段的中文文本基本正确地切分成词。词是中文的最小语素单位,但在书写时并不像英语会在词之间用空格分开,所以如何准确并快速分词一直是中文分词的攻关难点。SCWS采用纯C...
07th of March 2017 Linux Sphinx 2310

Linux中php安装sphinx扩展

sphinx客户端libsphinxclient安装(下面PHP模块需要)#cd/sphinx-2.2.11-release/api/libsphinxclient#./configure--prefix=/usr/local/libsphinxclient#make#makeinstall安装PHP的Sphinx模块下载地址:http://pecl.php.net/package/sphinx#wgethttp://203.187.160.133:9011/pecl.php.net/c3pr90ntc0td/get/s...