
使用linux打包目录时排除某些文件或目录
一般打包命令:
tar -zcvf /mnt/wwwroot.tar.gz /mnt/wwwroot
排除某目录或文件:
tar -zcvf /mnt/wwwroot.tar.gz --exclude=*.svn /mnt/wwwroot
此处加入 --exclude 参数排除,多个参数就写多个,
另外:如果需要排除的是目录,不能以/结尾.
一般打包命令:
tar -zcvf /mnt/wwwroot.tar.gz /mnt/wwwroot
排除某目录或文件:
tar -zcvf /mnt/wwwroot.tar.gz --exclude=*.svn /mnt/wwwroot
此处加入 --exclude 参数排除,多个参数就写多个,
另外:如果需要排除的是目录,不能以/结尾.
CentOS 7.x相对于6.x的改变
首先是目录结构方面的改变:
/bin转移到/usr/bin;/
sbin转移到/usr/sbin;
/lib转移到/usr/lib;
/lib64转移到/usr/lib64.
/var/run符号连接到/run;
/var/lock符号连接到/run/lock.
临时文件夹/tmp是内存虚拟出来的空间(tmpfs类型),systemctl enable/disable tmp.mount启用或停用。
特权进程,如后台服务等,临时文件存放在/run/processname;
进程临时文件较大,需要在服务器重启后可取回的放在/var/tmp,其他情况就放在/tmp下。
本地化配置由/etc/sysconfig/i18n转移到/etc/locale.conf和/etc/vconsole.conf。
hostname配置有/etc/sysconfig/network转移到/etc/hostname。
关于磁盘分区:
就在刚刚,我编译nginx的时候,突然得到了一条坑爹的提示:
./configure: error: invalid option "--with-http_spdy_module"
不应该啊,应该有spdy模块啊,无意中想到会不会是新版本的问题。我升级的是1.9.5..
于是找到官方文章看了一下,看到下面这段:
The ngx_http_v2_module module (1.9.5) provides support for HTTP/2 and supersedes thengx_http_spdy_module module. This module is not built by default, it should be enabled with the --with-http_v2_moduleconfiguration parameter.
把--with-http_spdy_module换成--with-http_v2_module之后重新编译通过...
附上NGINX官方说明:http://nginx.org/en/docs/http/ngx_http_v2_module.html
#!/bin/sh # POST-COMMIT HOOK # # The post-commit hook is invoked after a commit. Subversion runs # this hook by invoking a program (script, executable, binary, etc.) # named 'post-commit' (for which this file is a template) with the # following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] REV (the number of the revision just committed) # # The default working directory for the invocation is undefined
1、备份CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、完成之后清空yum缓存,并重建yum缓存
yum clean all && yum clean&n
Windows Explorer Shell 支持 Overlay Icon 最多15个,Windows OneDrive自身已经使用了5个,所以就只剩下了10个 供我们使用。
如果你之前安装了例如360UDiskGuard,SkyDrivePro这样的软件,那么可能我们可利用的就更少了,轮不到Tortoise了。像这样的情况,我们可以调整 Tortoise图标名称的字母顺序,来提高Tortoise的优先位置,因为Windows 内部就是安装名称的字母顺序来优先显示的。
解决的步骤:在运行里输入regedit进入注册表界面,
HKEY_LOCAL_MACHINE>SOFTWARE>Microsoft>Windows>CurrentVersion>Explorer>ShellIconOverlayIdentifiers
打开后发现Tortoise 系列前面有好多项,Tortoise 系列排到了15名之后,难怪不显示。现在的任务就是把它们提到前面了,名字前面的空格越多排名越靠前,然后关闭注册表,重启Explorer。
#回收内存 echo 1 > /proc/sys/vm/drop_caches #查看内存条数命令: dmidecode |grep -A16 "Memory Device$"
wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz chmod +x redis-2.6.14.tar.gz tar -xzvf redis-2.6.14.tar.gz cd redis-2.6.14 make make install
方法make命令执行完成后,会在src目录下生成5个可执行文件:
redis-server:Redis服务器的daemon启动程序
redis-cli:Redis命令行操作工具。当然,你也可以用telnet根据其纯文本协议来操作
redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
redis-check-aof:更新日志检查
redis-check-dump:用于本地数据库检查
if ( $args ~ "mosConfig_[a-zA-Z_]{1,21}(=|%3d)" ) { set $args ""; rewrite ^.*$ http://$host/index.php last; return 403; } if ( $args ~ "base64_encode.*(.*)") { set $args ""; rewrite ^.*$ http://$host/index.php last; return 403; } if ( $args ~ "(|%3E)") { set $args ""; rewrite ^.*$ http://$host/index.php last; return 403; } if ( $args ~ "GLOBALS(=|[|%[0-9A-Z]{0,2})") { set $args ""; rewrite ^.*$ http://$host/index.php last; return 403; } if ( $args ~ "_REQUEST(=|[|%[0-9A-Z]{0,2})") { set $args ""; rewrite ^.*$ http://$host/index.php last; return 403; } if (!-e $request_filename) { rewrite (/|.php|.html|.htm|.feed|.pdf|.raw|/[^.]*)$ /index.php last; break; }
在部分虚拟主机上面可能需要下面的格式的规则,比如华夏名网的nginx主机。
使用到的命令:
chmod #修改目录及文件权限 chown #修改目录及文件所有者 root:x #x用户组的root,用户组不必须
演示目录:
/home/wwwroot/default/
参数:
-R #递归,遍历目录下所有文件及子文件夹修改目录权限:
例:对目录下的所有文件与子目录执行相同的权限变更
#777 为所需设置的权限 chmod -R 777 /home/wwwroot/default/例:修改目录下所有文件与子目录的所有者
#使所有者修改为root用户 chown -R root /home/wwwroot/default/
nginx动态文件处理能力差?
这是我最困惑的地方,在google了nginx之后发现它的评价并没有想象中那么差劲,并且很多公司已经开始用nginx+php(fast-cgi)作为主流web服务器,于是我决定亲自试一试。
测试环境:
web服务器:192.168.0.235双核(Intel(R) Xeon(TM) CPU 3.00GHz)
测试客户端:192.168.30.149双核(Pentium(R) Dual-Core CPU E5200 @ 2.50GHz)
测试工具:
webbench-1.5 ,这里为何不用ab命令,因为测试时发现,在高并发下,ab命令可能会失败,在任务没有完成时,强制终止。所以我们要有一个容错的工具来进行测试。
直接进入主题
a、首先来看一下静态文件的处理性能比较:
①处理数据量比较
x轴:并发量
y轴:每秒钟的数据处理量(byte/sec)
这里不过多解释,nginx的静态处理能力完胜apache
先交代一下本次升级的环境
系统:centos6.3 64位
nginx 安装位置: /usr/local/nginx(不同的主机安装位置不同,使用以下代码时请注意做必要的替换)
手动安装的时候要替换你的安装位置,其中 /usr/local/nginx 是nginx的安装目录Shell
首先备份你原有的nginx
tar -zcvf nginx.tar.gz /usr/local/nginx/.
然后远程下载最新稳定版的 nginx
wget http://nginx.org/download/nginx-1.5.7.tar.gz
查看Nginx最新的版本号:http://nginx.org/en/download.html
将下载好的文件解压缩:
tar -zxvf nginx-1.5.7.tar.gz
解压后得到目录 nginx-1.5.7,进入该目录
cd nginx-1.5.7
接下来我们需要编译 nginx 的源码,在编译之前确保你的主机安装了必须的编译工具
yum install gcc openssl-devel pcre-devel zlib-devel
如果你不清楚编译时的选项,可以参考现有 nginx 的编译选项,查看方法
说明:历法扩展集包括了一系列用于在不同历法间进行转换的函数;
安装方法,同官方一样!
此安装包,包含安装文件和所需下载安装的压缩文件,
在服务器上安装了vsftpd,配置出错需要卸载vsftpd。卸载vsftpd的命令如下:
[root@localhost ~]# rpm -aq vsftpd vsftpd-2.0.5-16.el5_5.1 #此处是查找vsftpd的返回结果 [root@localhost ~]# rpm -e vsftpd-2.0.5-16.el5_5.1 #用rpm -e 查找结果 进行删除就ok了。 warning: /etc/vsftpd/user_list saved as /etc/vsftpd/user_list.rpmsave warning: /etc/vsftpd/ftpusers saved as /etc/vsftpd/ftpusers.rpmsave #删除时将备份vsftp的用户列表文件。
看下是否卸载了vsftpd,进行stop及start操作:
[root@localhost ~]# /sbin/service vsftpd stop vsftpd: unrecognized service #找不到vsftpd [root@localhost ~]# /sbin/service vsftpd start vsftpd: unrecognized service #找不到vsftpd记住,在卸载vsftpd之前,先停止vsftpd。