出售虚拟主机空间,博客空间,电信机房百兆带宽,具体信息请点击进入!200元起售!联系QQ:2477941 手机:13764407761
28,Aug,2008 | (7189/7)︾[置顶] 提供网站与博客系统空间解决方案
19,Jan,2012 | (15/0)在Linux(CentOS)安装MRTG的教程
一、MRTG需要以SNMP服务为基础,所以请确保你的系统已经启用了此服务(关于SNMP协议请参考:SNMP简介和MRTG监控过程)
1.请确保你的系统安装了以下软件包
net-snmp-5.0.6-17
net-snmp-devel-5.0.6-17
net-snmp-utils-5.0.6-17
使用YUM –y install net-snmp
Yum –y install net-snmp-devel
Yum –y install net-snmp-utils
1.请确保你的系统安装了以下软件包
net-snmp-5.0.6-17
net-snmp-devel-5.0.6-17
net-snmp-utils-5.0.6-17
使用YUM –y install net-snmp
Yum –y install net-snmp-devel
Yum –y install net-snmp-utils
19,Jan,2012 | (15/0)在Centos(RHEL)上安装和配置MRTG
MRTG是个很过时的东西.现在大多都用RRD,但配置有点麻烦,当然,用Cacti之类还是相当方便.但我在这使用MRTG原因有三.
1.我只有一台机器要用,比如我的个人网站.为了一个小服务器搞个cacti不值.象这样MRTG还是很方便的.
2.就算大面积使用Cacti加RRD还是有必要在本机运行一个可以直接查看的网页比较方便.方便运维排错.
3.可以在一个节点的一台机器上装一个MRTG,然后加上那个节点后面所有的机器,这样可以显示每个节点的流量,方便节点排错.
MRTG的全称叫 Multi Router Traffic Grapher 可以监控很多东西,今天我们就用它来监控我小小的个人网站的流量.节点之类多设备的设置后面也可以参考一下.
1.我只有一台机器要用,比如我的个人网站.为了一个小服务器搞个cacti不值.象这样MRTG还是很方便的.
2.就算大面积使用Cacti加RRD还是有必要在本机运行一个可以直接查看的网页比较方便.方便运维排错.
3.可以在一个节点的一台机器上装一个MRTG,然后加上那个节点后面所有的机器,这样可以显示每个节点的流量,方便节点排错.
MRTG的全称叫 Multi Router Traffic Grapher 可以监控很多东西,今天我们就用它来监控我小小的个人网站的流量.节点之类多设备的设置后面也可以参考一下.
18,Jan,2012 | (15/0)Nginx访问控制
一般网站的后台都不能给外部访问,所以要添加IP限制,通常只允许公司的IP访问
限制整个域名访问就要server下添加:
server {
listion 80;
server_name lihuipeng.blog.51cto.com;
root /opt/htdocs/www;
allow 100.100.100.100;
deny all;
还可以做到PHP的解释限制:
location ~ .*\.php?$
{
allow 100.100.100.100;
deny all;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
除了限制IP之然还可以给域名添加帐号码密验证:
server {
listion 80;
server_name lihuipeng.blog.51cto.com;
root /opt/htdocs/www;
allow 100.100.100.100;
deny all;
auth_basic “lihuipeng website”;
auth_basic_user_file htpasswd;
location ~ .*\.php?$
{
….
}
htpasswd 这个密码很眼熟吧,就是用apache生成的,也有在线生成htpasswd的!
限制整个域名访问就要server下添加:
server {
listion 80;
server_name lihuipeng.blog.51cto.com;
root /opt/htdocs/www;
allow 100.100.100.100;
deny all;
还可以做到PHP的解释限制:
location ~ .*\.php?$
{
allow 100.100.100.100;
deny all;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
除了限制IP之然还可以给域名添加帐号码密验证:
server {
listion 80;
server_name lihuipeng.blog.51cto.com;
root /opt/htdocs/www;
allow 100.100.100.100;
deny all;
auth_basic “lihuipeng website”;
auth_basic_user_file htpasswd;
location ~ .*\.php?$
{
….
}
htpasswd 这个密码很眼熟吧,就是用apache生成的,也有在线生成htpasswd的!
18,Jan,2012 | (15/0)Nginx限制带宽
用Nginx做下载服务的时候,可能会做下载速度限制,这个Nginx可以做到:
首先在http{}的配置中添加一条:
limit_zone one $binary_remote_addr 10m;然后在server{}的配置中添加:
location / {
limit_conn one 1; 限制线程
limit_rate 100k; 限制速度
}
表示限速100K每个客户端只允许一个线程
客户端最终速度=rate * conn,这样就可以完美的实现限制带宽的设置了。
首先在http{}的配置中添加一条:
limit_zone one $binary_remote_addr 10m;然后在server{}的配置中添加:
location / {
limit_conn one 1; 限制线程
limit_rate 100k; 限制速度
}
表示限速100K每个客户端只允许一个线程
客户端最终速度=rate * conn,这样就可以完美的实现限制带宽的设置了。
18,Jan,2012 | (16/0)nginx 禁止以ip形式访问服务器
在nginx.conf中加入:
server {
listen 80;
server_name _;
return 404;
}
加在所有server的前面!
然后重启服务!
server {
listen 80;
server_name _;
return 404;
}
加在所有server的前面!
然后重启服务!
18,Jan,2012 | (21/0)Nginx+mysql+php-fpm搭建高性能Nginx平台
系统环境:rhel4.7、centos5.5
1、马上看看所需软件
mysql-5.0.92.tar.gz
libiconv-1.13.tar.gz
libxml2-2.6.31.tar.gz
jpegsrc.v6b.tar.gz
freetype-2.3.5.tar.gz
zlib-1.2.3.tar.gz
libpng-1.2.40.tar.gz
gd-2.0.35.tar.gz
libmcrypt-2.5.7.tar.gz
php-5.2.17.tar.gz
php-5.2.17-fpm-0.5.14.diff.gz
pcre-8.01.tar.gz
nginx-0.9.5.tar.gz
memcache-2.2.5.tgz
eaccelerator-0.9.5.3.tar.bz2
呼拉拉,一大堆软件,马上看看怎么安装这一大堆软件!
1、马上看看所需软件
mysql-5.0.92.tar.gz
libiconv-1.13.tar.gz
libxml2-2.6.31.tar.gz
jpegsrc.v6b.tar.gz
freetype-2.3.5.tar.gz
zlib-1.2.3.tar.gz
libpng-1.2.40.tar.gz
gd-2.0.35.tar.gz
libmcrypt-2.5.7.tar.gz
php-5.2.17.tar.gz
php-5.2.17-fpm-0.5.14.diff.gz
pcre-8.01.tar.gz
nginx-0.9.5.tar.gz
memcache-2.2.5.tgz
eaccelerator-0.9.5.3.tar.bz2
呼拉拉,一大堆软件,马上看看怎么安装这一大堆软件!
18,Jan,2012 | (19/0)linux nginx php木马排查及加固整理
linux nginx php木马排查及加固整理
1、改变目录和文件属性,禁止写入
find -type f -name \*.php -exec chmod 444 {} \;
find -type d -exec chmod 555 {} \;
注:当然要排除上传目录、缓存目录等;
同时最好禁止chmod函数,攻击者可通过chmod来修改文件只读属性再修改文件
2、php配置
禁用危险函数
passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,
ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,popen,dl,
syslog,show_source
3、nginx配置
限制一些目录执行php文件
location~^/images/.*\.(php|php5)$
{
denyall;
}
location~^/static/.*\.(php|php5)$
{
denyall;
}
location~*^/data/(attachment|avatar)/.*\.(php|php5)$
{
denyall;
}
注:这些目录的限制必须写在
location~.*\.(php|php5)$
{
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
include fcgi.conf;
}
的前面,否则限制不生效
path_info漏洞修正:
在通用fcgi.conf顶部加入
if ($request_filename ~* (.*)\.php) {
set $php_url $1;
}
if (!-e $php_url.php) {
return 404;
}
4、木马查找
php木马一般含有或者
find /data/wwwroot/* -type f -name "*.php" |xargs grep "eval(" > /root/scan.txt
还有
常见的一句话后门:
grep -r --include=*.php '[^a-z]eval($_POST' . > grep.txt
grep -r --include=*.php 'file_put_contents(.*$_POST\[.*\]);' . > grep.txt
把搜索结果写入文件,下载下来慢慢分析,其他特征木马、后门类似。有必要的话可对全站所有文件来一次特征查找,上传图片肯定有也捆绑的,来次大清洗。
5、查找近3天被修改过的文件:
find /data/www -mtime -3 -type f -name \*.php
注意:攻击者可能会通过touch函数来修改文件时间属性来避过这种查找,所以touch必须禁止
1、改变目录和文件属性,禁止写入
find -type f -name \*.php -exec chmod 444 {} \;
find -type d -exec chmod 555 {} \;
注:当然要排除上传目录、缓存目录等;
同时最好禁止chmod函数,攻击者可通过chmod来修改文件只读属性再修改文件
2、php配置
禁用危险函数
passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,
ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,popen,dl,
syslog,show_source
3、nginx配置
限制一些目录执行php文件
location~^/images/.*\.(php|php5)$
{
denyall;
}
location~^/static/.*\.(php|php5)$
{
denyall;
}
location~*^/data/(attachment|avatar)/.*\.(php|php5)$
{
denyall;
}
注:这些目录的限制必须写在
location~.*\.(php|php5)$
{
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
include fcgi.conf;
}
的前面,否则限制不生效
path_info漏洞修正:
在通用fcgi.conf顶部加入
if ($request_filename ~* (.*)\.php) {
set $php_url $1;
}
if (!-e $php_url.php) {
return 404;
}
4、木马查找
php木马一般含有或者
find /data/wwwroot/* -type f -name "*.php" |xargs grep "eval(" > /root/scan.txt
还有
常见的一句话后门:
grep -r --include=*.php '[^a-z]eval($_POST' . > grep.txt
grep -r --include=*.php 'file_put_contents(.*$_POST\[.*\]);' . > grep.txt
把搜索结果写入文件,下载下来慢慢分析,其他特征木马、后门类似。有必要的话可对全站所有文件来一次特征查找,上传图片肯定有也捆绑的,来次大清洗。
5、查找近3天被修改过的文件:
find /data/www -mtime -3 -type f -name \*.php
注意:攻击者可能会通过touch函数来修改文件时间属性来避过这种查找,所以touch必须禁止
18,Jan,2012 | (16/0)Apache,Nginx无需重启动态加载配置文件
Apache:
httpd -t //检查配置是否正确
service httpd reload //重新加载配置
Nginx:
1) nginx -t; nginx -s reload
2) nginx -t
ps aux |grep nginx //查找master process pid
kill -HUP
nginx -t 检查nginx配置的语法,操作前都要检查一下,很重要,发现错误可及时修正.
httpd -t //检查配置是否正确
service httpd reload //重新加载配置
Nginx:
1) nginx -t; nginx -s reload
2) nginx -t
ps aux |grep nginx //查找master process pid
kill -HUP
nginx -t 检查nginx配置的语法,操作前都要检查一下,很重要,发现错误可及时修正.
18,Jan,2012 | (18/0)Nginx高性能优化插件与缓存的安装和配置
1.1下载模块:
memc-nginx-module
下载地址: https://github.com/agentzh/memc-nginx-module/downloads
srcache-nginx-module
下载地址: https://github.com/agentzh/srcache-nginx-module/downloads
ngx_http_upstream_keepalive
下载地址: http://mdounin.ru/hg/ngx_http_upstream_keepalive/
解压在Nginx安装目录的同级目录下。
接着添加google-perftools-module模块,用来优化高并发时的内存管理性能
先安装 libunwind
# wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.0.1.tar.gz
# CFLAGS=-fPIC ./configure --prefix=/usr
# make CFLAGS=-fPIC
# make CFLAGS=-fPIC install
再安装 google-perftools
memc-nginx-module
下载地址: https://github.com/agentzh/memc-nginx-module/downloads
srcache-nginx-module
下载地址: https://github.com/agentzh/srcache-nginx-module/downloads
ngx_http_upstream_keepalive
下载地址: http://mdounin.ru/hg/ngx_http_upstream_keepalive/
解压在Nginx安装目录的同级目录下。
接着添加google-perftools-module模块,用来优化高并发时的内存管理性能
先安装 libunwind
# wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.0.1.tar.gz
# CFLAGS=-fPIC ./configure --prefix=/usr
# make CFLAGS=-fPIC
# make CFLAGS=-fPIC install
再安装 google-perftools
18,Jan,2012 | (12/0)Nginx禁止wordress上传目录执行PHP
禁止wordpress目录的上传目录执行PHP
location ~* ^/wp-content/(uploads|cache)/.*\.php$ {
deny all;
}
举一反三.
location ~* ^/wp-content/(uploads|cache)/.*\.php$ {
deny all;
}
举一反三.
18,Jan,2012 | (15/0)web.config配置优化,防止aspxspy的非法权限
通过配置 web.config 可以限制 ASP.NET 代码访问安全性。统一显示错误页面等等,对安全ASP.NET网站的安全性起到一定的作用。
<system.web>
<!-- 关闭调试功能 -->
<compilation debug="false"/>
<authentication mode="Windows" />
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节
可以配置相应的处理步骤。具体而言,
开发人员通过该节可配置要显示的 html 错误页,
以代替错误堆栈跟踪。
-->
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<!--
等级: level="[Full|High|Medium|Low|Minimal]"
Full: 无限制的权限。应用程序可访问任何属于操作系统安全范围的资源。支持所有的特权操作。
High: 不能调用未托管代码、调用服务组件、写入事件日志、访问 Microsoft 消息队列、访问 OLE DB 数据源
Medium: 除上述限制外,还限制访问当前应用程序目录中的文件,不允许访问注册表。
Low: 除上述限制外,应用程序不能与 SQL Server 连接,代码不能调用 CodeAccessPermission.Assert(无断言安全权限)。
Minimal: 仅有执行权限。
防止像aspxspy这类的大马,设置马Medium,基本上就没作用了。
-->
<trust level="Medium" originUrl=""/>
</system.web>
微软官方网站相关文档:http://msdn.microsoft.com/zh-cn/aa302424.aspx#EMAA
<system.web>
<!-- 关闭调试功能 -->
<compilation debug="false"/>
<authentication mode="Windows" />
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节
可以配置相应的处理步骤。具体而言,
开发人员通过该节可配置要显示的 html 错误页,
以代替错误堆栈跟踪。
-->
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<!--
等级: level="[Full|High|Medium|Low|Minimal]"
Full: 无限制的权限。应用程序可访问任何属于操作系统安全范围的资源。支持所有的特权操作。
High: 不能调用未托管代码、调用服务组件、写入事件日志、访问 Microsoft 消息队列、访问 OLE DB 数据源
Medium: 除上述限制外,还限制访问当前应用程序目录中的文件,不允许访问注册表。
Low: 除上述限制外,应用程序不能与 SQL Server 连接,代码不能调用 CodeAccessPermission.Assert(无断言安全权限)。
Minimal: 仅有执行权限。
防止像aspxspy这类的大马,设置马Medium,基本上就没作用了。
-->
<trust level="Medium" originUrl=""/>
</system.web>
微软官方网站相关文档:http://msdn.microsoft.com/zh-cn/aa302424.aspx#EMAA








