js挂马

首页通过搜索引擎,点击后跳转到另外一个主页,查找php木马也查找不到,用命令发现有一个木马加密隐藏在模板里,网站是通过phpcms写的,phpcms的权限设置有点问题。导致经常中木马。

最后通过firebug发现首页里有一条访问js代码跳转到其他域名。原来是写到js脚本最后。

Posted in linux | Leave a comment

wordpress在lnmp环境下静态化

wordpress的静态化网上有以下几种方式

第一种最普遍的

location / {
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;
}
}

第二种

http://www.lutuzhi.com/opensource/306.html

if (!-e $request_filename) {

#下面四行斜体字实现链接rewrite,http://www.lutuzhi.com中的所有页面实现了静态化 

rewrite ^/(index|atom|rsd)\.xml$ http://www.lutuzhi.com last;

rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last;

rewrite ^([_0-9a-zA-Z-]+)?(/.*\.php)$ $2 last;

rewrite ^ /index.php last;

}

第三种

http://www.tetx.com/program/htm/tetx/blog/view/blog_id/1291521408/index.htm

location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php;
}

wordpress 后台设置为:

Settings — Permalinks — Common settings — Custom Structure 输入

/%year%/%monthnum%/%day%/%postname%.html

 

设置—固定连接—自定义结构

参考:http://wiki.nginx.org/Wordpress

Posted in linux | Leave a comment

lftp mirror 脚本

参考文章如下网站的

http://www.centos.bz/2011/06/incremental-backup-site-using-lftp/

http://www.myamiga.com/journal/2011/03/25/using-lftp-to-mirror-content/

http://168.site90.net/doku.php?id=shell-script-mirror-ftp-sites-using-lftp

#!/bin/sh
/usr/bin/lftp -u admin,metcxxxx -e “mirror -svn /  /home/wwwroot/www ;exit”172.16.16.33

mirror下载目录 mirror  src  local 要指定远程路径和本地路径

Posted in linux | Leave a comment

centos awstats

参考如下文章

http://centoshelp.org/servers/configuring-awstats-multiple-domains-hosted-on-the-same-server/

首先安装epel 和rpmforge 源

yum install  install awstats GeoIP-data perl-Geo-IP cronolog

geoip的国家和城市的数据装不了要手动下载

mkdir /var/www/GeoIP; cd /var/www/GeoIP

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

gunzip GeoIP.dat.gz GeoLiteCity.dat.gz

vi  /etc/httpd/conf/httpd.conf

修改日志格式

CustomLog “|/usr/sbin/cronolog  /var/log/httpd/www.xx.com.%Y%m%d.log” combined

cp /etc/awstats/awstats.model.conf /etc/awstats/awstats.www.xx.com.conf

vi /etc/awstats/awstats.stats.example.com.conf We will be editing the following lines: 1. LogFile=”/var/log/httpd/www.jxx.com.%YYYY-0%MM-0%DD-0.log”

可以查看awastats的配置文件上方有详细说明 -24是前一天的日志

2. SiteDomain=”stats.example.com” 3. HostAliases=”stats.example.com” 4. DirData=”/var/www/stats.example.com/” 5. LoadPlugin=”geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat” (using the yum install method) 6. LoadPlugin=”geoip GEOIP_STANDARD /var/www/GeoIP/GeoIP.dat” (using the MaxMind direct download method) 7. LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD /var/www/GeoIP/GeoLiteCity.dat” (using the MaxMind direct download method)
awstats与apache的日志格式不一样 要修改成上述格式

vi /etc/httpd/conf.d/awstats.conf
allow forn all
perl /var/www/awstats/awstats.pl -config=www.xx.com -update > /dev/null 2>&1

 

<Directory "/var/www/stats.example.com">
AuthName "Restricted Area"
AuthType Basic
AuthBasicProvider file
AuthUserFile /var/www/stats.example.com/.htpasswds
AuthGroupFile /dev/null
require valid-user
</Directory>

 

htpasswd -bc admin  metc7626160 .htpasswd

遇到点故障,发现脚本每天都没有执行crond 系统是centos6  结果发现minimal最小化安装没有安装crontabs yum install 一下就ok了

Posted in linux | Leave a comment

centos setup 配置工具

yum install setup  system-config-firewall   system-config-firewall-tui   system-config-services  system-config-network-tui   ntsysv

ntsysv 才能出来配置服务选项

Posted in linux | Leave a comment

date

delday=$(date -d “7 days ago” +%Y%m%d)

Posted in 日记 | Leave a comment

centos6 yum 时出现[Errno 14] PYCURL ERROR 6 – “”

[Errno 14] PYCURL ERROR 6 – “”

竟然是nameserver的问题 用google的dns

Posted in linux | Leave a comment

windows 下载网站

http://msdn.itellyou.cn/

Posted in windows | Leave a comment

禁止win7驱动签名

bcdedit/set testsigning on

Posted in windows | Leave a comment

dede挂马处理

一个虚拟主机网站被挂马 dede做的 用php挂的马也删除不掉、发现是在templates里的!!手动删除 重新生成首页

Posted in linux | Leave a comment