禁止解析PHP、限制user_agent、php相关配置
2018-06-03 22:58
615 查看
11.28 限定某个目录禁止解析php
核心配置文件内容<Directory /data/wwwroot/www.123.com/upload> php_admin_flag engine off <FilesMatch (.*)/.php(.*)> Order allow,deny Deny from all </FilesMatch> </Directory>
curl测试时直接返回了php源代码,并未解析
可以写的目录,99%不需要解析php,静态文件所存放的目录,不允许存放php。
11.29 限制user_agent
user_agent可以理解为浏览器标识核心配置文件内容
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_USER_AGENT} .*curl.* [NC,OR] RewriteCond %{HTTP_USER_AGENT} .*baidu.com.* [NC] RewriteRule .* - [F] </IfModule>//NC 忽略大小写,F为fobidden的意思
curl -A "123123" -x127.0.0.1:80 'http://111.com/123.hph'
-A 指定user_agent
-e 指定referer 必须以“http://”开头
-x 省略hosts
-I 仅仅查看状态码
11.30/11.31 php相关配置
查看php配置文件位置/usr/local/php/bin/php -i|grep -i "loaded configuration file"
在根目录下创建phpinfo(),如下:
<?php phoinfo();
通过浏览器查看phpifo;找到路径,找到源码包
# cd /usr/local/src/php-7.1.6/
# cp php.ini-development /usr/local/php7/etc/php.ini
# /usr/local/apache2.4/bin/apachectl graceful此时在打开浏览器,查看Loaded Configuration Files的路径
date.timezone //定义时区,Asia/Shanghai
disable_functions 将以下函数禁用
eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close //危险的函数,
display on或off,打开或者关闭错误提示
error_log//定义log路径, log_errors//是否打开错误日志, display_errors, error_reporting//定义日志的级别,默认为E_all,生产环境上使用E_ALL & ~E_NOTICE
open_basedir =/data/wwwroot/111.com:/tmp //php.ini是针对所有站点的,可以在apache的配置文件中做配置,如下: php_admin_value open_basedir "/data/wwwroot/111.com:/tmp/"
扩展
apache开启压缩 http://www.aminglinux.com/bbs/thread-5528-1-1.htmlapache2.2到2.4配置文件变更 http://www.aminglinux.com/bbs/thread-7292-1-1.html
apache options参数 http://www.aminglinux.com/bbs/thread-1051-1-1.html
apache禁止trace或track防止xss http://www.aminglinux.com/bbs/thread-1045-1-1.html
apache 配置https 支持ssl http://www.aminglinux.com/bbs/thread-1029-1-1.html
相关文章推荐
- 限定某个目录禁止解析php,限制user_agent,php相关配置
- LAMP架构(八)限定某个目录禁止解析、 限制user_agent、php相关配置
- 限定某个目录禁止解析php 限制user_agent php相关配置
- 11.28-31 限定某个目录禁止解析php, 限制user_agent, php相关配置
- 限定某个目录禁止解析php,限制user_agent,php相关配置
- 11.28 限定某个目录禁止解析php;11.29 限制user_agent;11.30,11.31 php相关配置(上下)
- 十一周第二次课 2017.12.26 限定某个目录禁止解析php、限制user_agent、php相关配置
- 10-4 11 禁止某个目录解析PHP 限制user_agent php相关配置
- 11.28 限定某个目录禁止解析php 11.29 限制user_agent 11.30/11.31 php相关配置
- 限定某个目录禁止解析php、限制user_agent、php相关配置
- 限定某个目录禁止解析php、限制user_agent、php相关配置
- 限定某个目录禁止解析php、限制user_agent、PHP相关配置
- 【LAMP环境搭建】限定某个目录禁止解析php、限制user_agent和php相关配置
- 禁止解析PHP、限制user_agent、php相关配置
- 11.28 限定某个目录禁止解析php 11.29 限制user_agent 11.30/11.31 php相关配置
- 限定某个目录禁止解析php、限制user_agent、php相关配置(php日志)
- 11.28 限定某个目录禁止解析php 11.29 限制user_agent 11.30/11.31 php相关配置
- 限定某个目录禁止解析php、限制user_agent和PHP相关配置
- 禁止解析PHP、限制user_agent、配置PHP