Aug 29
作者: 肖建彬 | 可以转载, 转载时务必以超链接形式标明文章原始出处和作者信息及版权声明
网址:http://www.xiaojb.com/archives/it/apachephpmysql.shtml

1) /etc/php.ini部分
disable_functions = phpinfo
禁止使用某些函数
expose_php = Off
禁止返回header,X-Powered-By: PHP/4.3.11
display_errors = Off
不输出错误
log_errors = On
错误记录在日志里边。

2) apache中的设定

只在必要的虚机里边加入
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

每个<Directory “/”>的Options都要把Indexs

ServerSignature Off
ServerTokens OS
这个标记也要改

php_admin_value open_basedir /var/www/html/:/tmp/:/usr/share/pear
设定php只能打开特定目录

<Directory /var/www/html/include>
Order deny,allow
Deny from all
</Directory>
<Files config.php>
Order deny,allow
Deny from all
</Files>

保护好用户不需要直接访问的配置文件。

3) mysql
/etc/my.cnf
[mysqld]
bind-address = 127.0.0.1

设置mysqld绑定在本地回环地址
mysqladmin -uroot password ‘new-password’
root的密码不能为空

5 Responses to “apache+php+mysql的安全设定”

  1. 踩一脚 Says:

    呵呵,看了屋主的相片,突然想起原来每一个写程序的人都长成那样,(在我所认识的那些人)估计是因为做技术的人比较辛苦,得有很好的体格,呵呵,我现在知道了我为什么不适合去做那样的工作,因为我的体格不如他……

  2. xjb Says:

    是我土:(

  3. 再踩一脚 Says:

      呵呵,没那意思!屋主那么玉树临风,想必是被美女前呼后拥了,羡慕的不行!

      

  4. nothing Says:

    这楼上的真是吃人不吐皮阿,有本事把你得玉照放上来瞅瞅呀

  5. 再再踩一脚 Says:

    第一:没什么本事!
    第二:不吃人!
    第三:不知道什么叫玉照!