apache2+php+mysql+mod_secu+mod_evasive
下载:
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
mysql 安装:
$ tar zxvf mysql-<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">4.1.15</chsdate>.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 . [后面有个点啊KKK chown -R root .]
# chown -R mysql var
# chgrp -R mysql . [同样有个. chgrp -R mysql .]
# bin/mysqld_safe --user=mysql &
apache 2 安装:
$ tar jxvf httpd-<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">2.0.55</chsdate>.tar.bz2
$ cd httpd-2.055
$ vi config.sh 写入内容如下:
代码: |
#!/bin/bash
HTTPD_ROOT="/apache2"
./configure --prefix=/apache2 \
--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=/apache2 \
--enable-so \
--enable-rewrite \
--enable-info \
--enable-cgid \
--enable-mime-magic \
--enable-vhost-alias \
--enable-deflate \
--enable-expires \
写一个config.sh 只是个人习惯方便今后查看和升级再编译。
# make
# make install
安装php4
$ tar jxvf php-<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">4.4.1</chsdate>.tar.bz2
$ cd php-4.4.1
$ vi config.sh 写入内容:
代码: |
#!/bin/bash
PHP_ROOT=/apache2
./configure --prefix=$PHP_ROOT \
--with-apxs2=$PHP_ROOT/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
|
$ make
# make install
安装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
$/usr/local/apache-<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">2.0.55</chsdate>/bin/apxs -cia mod_security.c[/usr/local/apache-2.0.55/bin/apxs是实际安装apache的路径]
安装mod_evasive防DDOS攻击
# tar zxvf mod_evasive_<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.10.1</chsdate>.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
打开 httpd.conf文件
查看是否有, 如没有则加上去
LoadModule evasive20_module modules/mod_evasive20.so
添加一段mod_evasive20的配置文件
代码: |
<IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 </IfModule>
|
配置:
1.编辑/etc/my.cnf
去掉[mysqld]段skip-networking这句的注释,这样mysql只能从本机连接,有助提高安全性。
2.编辑/apache/conf/httpd.conf
修改ServerAdmin irunnet.com@irunnet.com将后面的mail 地址改为服务器管理员地址。
增加一个php 文件配置
AddType application/x-httpd-php .php
在DirectoryIndex 后增加一个 index.php
增加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 w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">2.0.48</chsdate> # 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
|
添加一段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>
|
添加一段mod_evasive20的配置文件
代码: |
<IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 2 DOSSiteCount 50 DOSPageInterval 1 DOSSiteInterval 1 DOSBlockingPeriod 10 </IfModule>
|
测试:
在/apache2/htdocs 创建文件phpinfo.php 内容为:
代码: |
<?php echo phpinfo(); ?> |
在浏览器中打开 http://127.0.0.1/phpinfo.php 如果你能看到 phpinfo 界面那么ok。
分享到:
相关推荐
Red Hat Linux security guide -- version 7
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...
Projet_Secu_Reseau 由 Micael LEAL 制作的项目 A.Dulanoy 网络安全项目 ##环境设置## 用Java编写的程序 必须安装 NetBeans 或 Eclipse 并以管理员身份运行,否则无法在网卡上访问 运行 ClassicPcap.java + 不要...
本项目主要使用spring security对restful webservice进行安全控制
repo_secu 高年级数据科学项目 Update3文件包含准确性指标的后端计算,用于预测理论存储库是否“不安全”。 这主要是基于理论回购内容的良性课程。 生成了两个输出CSV文件。 Visu文件在matplotlib中生成图形。
这2个端口在安全策略里已经限制.... 这是才恍然大悟... 于是到控制面板-管理工具-本地安全策略-IP安全策略-里面有个新的策略并指派的-进去把3389删除, 于是就可以打开终端了,并重新开启防火墙....站点可以正常...
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 : ...
secu_dev_project_SECRETS
通用安全组Terraform模块 用法示例 module "my-sg" { source = "git@github.com:stain89/terraform-module-security-group.git" vpc_id = "vpc-a27e94ea" name = "test" environment = "dev" ... source_secu
华为赛门铁克HSCSA_Security认证培训网络课程数据通信网络技术.docx华为赛门铁克HSCSA_Security认证培训网络课程数据通信网络技术.docx华为赛门铁克HSCSA_Security认证培训网络课程数据通信网络技术.docx华为...
应用程序SECU_CLI Cette应用程序可从sécuritesociale的基本信息中获取信息。eéécriten模式控制台PHP_CLI。 [^ 1]:Sans suiste。
xieyuan_library本人编写和摘入的一些实用的android代码库涵盖:1、滑动Activity边缘即可finishActivity2、com.pwdgame.httpHttp请求高度封装,支持永久缓存、定时缓存3、com.pwdgame.view各种VIEW,如弹出菜单、...
Author: Michael E. Whitman, Michael E. Whitman The purpose of this textbook is to fulfill the need for a quality academic textbook in the discipline of information security management.
Neo4j Java Reference 3.0
藏经阁-Protecting-Pentests-Recommendations-For-Performing-More-Secu
SECUI MF2 防火墙(SECUI 第二代多功能防火墙) MF2 300 软件和硬件性能参数
Oracle Solaris 9 - Administrator’s Guide to Security Sun ONE Application Server-150
3. 在系统设备栏中找到Inside Programming SECU-X BUS, 又键单击. 选择UNINSTALL. 4. 到 系统盘:\Program Files\InsPro目录, 全删除. 5. 到 系统盘:\windows(winnt)\system32\drivers目录, 删除SDBUS.SYS和SDDISK....
呵呵呵 你懂得 科学使用 SecureCRT 8.5中的新功能(官方) 改进的按钮栏管理:按钮栏...vsh / vsftp / vcp增强功能:vsh,vsftp和vcp现在支持hmac-sha2-512-etm@openssh.com和hmac-sha2-256-etm@openssh.com MAC。