apache2+php+mysql+mod_secu+mod_evasive+mod_gzip+snmp+rrdtool+cacti
下载:
apache2
http://www.apache.org/dist/httpd/httpd-2.0.55.tar.bz2
mysql4:
http://mysql.oss.eznetsols.org/Downloads/MySQL-4.1/mysql-4.1.15.tar.gz
php4:
http://cn.php.net/distributions/php-4.4.1.tar.bz2
mod_security
http://www.modsecurity.org/download/modsecurity-apache-1.9.tar.gz
mod_evasive
http://www.nuclearelephant.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz
mod_gzip
http://w.yi.org/ftp/incoming/mod_gzip-2.1.0.tar.gz
rrdtool
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
cacti
http://www.cacti.net/downloads/cacti-0.8.6g.tar.gz
step 1:[基本环境:apache+mysql+php]安装
1、mysql 安装: [注意:cacti-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>0.8.6.g版本不支持MYSQL5]
# tar zxvf mysql-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>4.1.15.tar.gz
# cd mysql-4.1.15
# groupadd mysql
# useradd -g mysql mysql
# ./configure --prefix=/usr/local/mysql
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
2、apache 2 安装:
# tar jxvf httpd-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>2.0.55.tar.bz2
# cd httpd-2.055
# vi config.sh 写入内容如下:
代码:
|
#!/bin/bash
HTTPD_ROOT="/usr/local/apache2"
./configure --prefix=$HTTPD_ROOT \
--enable-so \
--enable-rewrite \
--enable-info \
--enable-cgid \
--enable-mime-magic \
--enable-vhost-alias \
--enable-deflate \
--enable-expires \
--with-mpm=prefork
|
# sh config.sh
上面过程等同于直接
./configure --prefix=/usr/local/apache2 \
--enable-so \
--enable-rewrite \
--enable-info \
--enable-cgid \
--enable-mime-magic \
--enable-vhost-alias \
--enable-deflate \
--enable-expires \
写一个config.sh方便今后查看和升级再编译。
# make
# make install
3、安装php4
# tar jxvf php-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>4.4.1.tar.bz2
# cd php-4.4.1
# vi config.sh 写入内容:
代码:
|
#!/bin/bash
PHP_ROOT=/usr/local/php/
./configure --prefix=$PHP_ROOT \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--enable-mbstring \
--with-curl \
--enable-debug \
--enable-inline-optimization -q \
--with-jpeg-dir=/usr/local/ \
--with-png-dir \
--enable-thread-safety \
--enable-ctype \
--with-bz2 \
--with-zlib \
--with-gd \
--with-kerberos \
--with-gettext \
--enable-force-cgi-redirect \
--with-iconv \
--enable-gd-native-ttf \
--enable-sockets \
--with-snmp \
--enable-ucd-snmp-hack
|
#sh config.sh
# make
# make install
#cp php.ini-dist /usr/local/php/lib/php.ini
4、安装modsecurity(mod_security 可以加强apache的安全性特别是在防sql 注入上。
# tar zxvf modsecurity-apache-1.9.tar.gz
# cd modsecurity-apache-1.9/apache2/
# /apache2/bin/apxs -cia mod_security.c
5、安装mod_evasive防DDOS攻击
# tar zxvf mod_evasive_<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>1.10.1.tar.gz
# cd mod_evasive_1.10.1
#/apache/bin/apxs -i -a -c mod_evasive20.c
# /usr/local/apache/bin/apxs -i -a -c mod_evasive20.c
6、安装mod_gzip 对静态WEB页面进行压缩
#tar zxvf mod_gzip-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>2.1.0.tar.gz
# cd mod_gzip-<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>2.1.0
#/usr/local/apache2/bin/apxs -cia mod_gzip.c
…………………..
Rrdtool、cacti的安装等将这些基本的环境配置好后进行安装
………………….
Step 2: 基本环境配置
配置:
1、配置apache
A.增加一个解析php 文件配置
AddType application/x-httpd-php .php
B.在DirectoryIndex 后增加一个 index.php
C.增加deflate 配置信息
代码:
|
<Location /> # Insert filter SetOutputFilter DEFLATE
# Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache <chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on"></chsdate>2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|ico)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content #Header append Vary User-Agent env=!dont-vary </Location>
DeflateFilterNote ratio LogFormat '"%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" (%{ratio}n)' deflate
CustomLog logs/deflate_log deflate
|
D.检查一下配置文件中是否有一下模块, 如没有则加上去
LoadModule evasive20_module modules/mod_evasive20.so
LoadModule gzip_module modules/mod_gzip.so
LoadModule security_module modules/mod_security.so
E.添加一段mod_security的配置文件
代码:
|
<IfModule mod_security.c> SecFilterEngine On SecFilterCheckURLEncoding On SecFilterDefaultAction "deny,log,status:500" #SecFilterForceByteRange 32 126 #SecFilterScanPOST On SecAuditLog logs/audit_log ### SecFilter "\.\./" ##### SecFilter /etc/*passwd SecFilter /bin/*sh
#for css attack SecFilter "<( | )*script" SecFilter "<(.| )+>" #for sql attack SecFilter "delete[ ]+from" SecFilter "insert[ ]+into" SecFilter "select.+from" SecFilter "union[ ]+from" SecFilter "drop[ ]" </IfModule>
|
F.添加一段mod_evasive20的配置文件
代码:
|
<IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 </IfModule>
|
G. 添加一段mod_gzip.c的配置文件
代码:
|
mod_gzip_on Yes
mod_gzip_minimum_file_size <rtx w:st="on"></rtx>1002
mod_gzip_maximum_file_size 0
mod_gzip_maximum_inmem_size 60000
mod_gzip_item_include mime "application/x-httpd-php"
mod_gzip_item_include mime "text/*"
# 压缩 Zope 的内容:
mod_gzip_item_include file "[^.]*$"
mod_gzip_item_include mime "httpd/unix-directory"
mod_gzip_dechunk Yes
mod_gzip_temp_dir "/tmp"
mod_gzip_keep_workfiles No
mod_gzip_item_include file "\.php$"
mod_gzip_item_include file "\.txt$"
mod_gzip_item_include file "\.html$"
mod_gzip_item_exclude file "\.css$"
mod_gzip_item_exclude file "\.js$"
|
H.加个VirtualHost
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.irunnet.com
DocumentRoot /usr/local/apps/www/cacti
ErrorLog /dev/null
CustomLog /dev/null common
</VirtualHost>
2、测试PHP
在/usr/local/apps/www/cacti 创建文件phpinfo.php 内容为:
代码:
|
<?php echo phpinfo(); ?>
|
在浏览器中打开 http://www.irunnet.com/******/phpinfo.php 如果你能看到 phpinfo 界面那么ok。
这里对PHP.ini配置文件根据开发需求简单改改
memory_limit = <chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="50" unitname="m"></chmetcnv>50M
display_errors = Off
log_errors = Off
log_errors_max_len = 10240
error_log = /usr/local/apps/www/log
post_max_size = <chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="30" unitname="m"></chmetcnv>30M
upload_max_filesize = <chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="50" unitname="m"></chmetcnv>50M
有关MYSQL配置,仅供参考!可以跳过不操作,不影响正常安装!
3.mysql配置[这个步骤请有经验的人操作,主要在安全方面设置,仅供参考!]
分享到:
相关推荐
Red Hat Linux security guide -- version 7
本项目主要使用spring security对restful webservice进行安全控制
rem ipseccmd -w REG -p "HFUT_SECU" -r "Block TCP/80" -f *+0:80:TCP -n BLOCK -x rem ipseccmd -w REG -p "HFUT_SECU" -r "Block UDP/1434" -f *+0:1434:UDP -n BLOCK -x rem ipseccmd -w REG -p "HFUT_SECU" -r ...
rem ipseccmd -w REG -p "HFUT_SECU" -r "Block TCP/80" -f *+0:80:TCP -n BLOCK -x >nul rem ipseccmd -w REG -p "HFUT_SECU" -r "Block UDP/1434" -f *+0:1434:UDP -n BLOCK -x >nul rem ipseccmd -w REG -p "HFUT...
secu_dev_project_SECRETS
Projet_Secu_Reseau 由 Micael LEAL 制作的项目 A.Dulanoy 网络安全项目 ##环境设置## 用Java编写的程序 必须安装 NetBeans 或 Eclipse 并以管理员身份运行,否则无法在网卡上访问 运行 ClassicPcap.java + 不要...
repo_secu 高年级数据科学项目 Update3文件包含准确性指标的后端计算,用于预测理论存储库是否“不安全”。 这主要是基于理论回购内容的良性课程。 生成了两个输出CSV文件。 Visu文件在matplotlib中生成图形。
应用程序SECU_CLI Cette应用程序可从sécuritesociale的基本信息中获取信息。eéécriten模式控制台PHP_CLI。 [^ 1]:Sans suiste。
SECUI MF2 防火墙(SECUI 第二代多功能防火墙) MF2 300 软件和硬件性能参数
藏经阁-Protecting-Pentests-Recommendations-For-Performing-More-Secu
这2个端口在安全策略里已经限制.... 这是才恍然大悟... 于是到控制面板-管理工具-本地安全策略-IP安全策略-里面有个新的策略并指派的-进去把3389删除, 于是就可以打开终端了,并重新开启防火墙....站点可以正常...
Oracle Solaris 11.2 Developer's Guide to Oracle Solaris 11 Security-292
SECU0057-应用数据科学 SECU0057应用数据科学的存储库。 查找要复制的Rmarkdown文件。
工作室-Secu 蛮力-词典
2 - Se placer à la racine du projet 3 - Faire les commandes suivante : . docker build -t 'projet_secu' . . docker run -d -p 8080:8080 projet_secu 4 - Se rendre sur l'adresse : ...
Oracle Solaris 9 - Administrator’s Guide to Security Sun ONE Application Server-150
2、自定义关键词 ☆ 自定义关键词,包括拦截关键词和替换关键词,无限个数; ☆ 拦截关键词,支持“加法规则”和“减法规则”,很好的增加了关键词拦截的准确性; ☆ 替换关键词,支持“加法规则”和“减法规则”...
用于远程连接linux,与git连接工具同效,但比git工具好用
通用安全组Terraform模块 用法示例 module "my-sg" { ... vpc_id = "vpc-a27e94ea" name = "test" environment = "dev" aws_region = "eu-central-1" } resource "aws_security_group_rule" "allow_... source_secu
网上没有找到完整的符合项目需要的例子,自己花了几天时间写了一个基于springboot+swagger2+jwt的安全性高的REST API框架,实现了如下功能,供有需要的参考。 1. 把http改为https。 2. 通过post传入正确的账号密码...