生活随笔
收集整理的這篇文章主要介紹了
禁止解析PHP、限制user_agent、php相关配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
11.28 限定某個目錄禁止解析php
核心配置文件內容 <Directory /data/wwwroot/www.123.com/upload>php_admin_flag engine off</Directory>
curl測試時直接返回了php源代碼,并未解析可以寫的目錄,99%不需要解析php,靜態文件所存放的目錄,不允許存放php。11.29 限制user_agent
user_agent可以理解為瀏覽器標識核心配置文件內容 <IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{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(),如下:<?phpphoinfo();
通過瀏覽器查看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/Shanghaidisable_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_NOTICEopen_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.html
apache2.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
轉載于:https://my.oschina.net/u/3803446/blog/1823511
總結
以上是生活随笔為你收集整理的禁止解析PHP、限制user_agent、php相关配置的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。