wdcp nginx php5.2.17存在跨站,以及解决方法。
nginx php5.2.17存在跨站,没有像apache那样可以限制open_base_dir限制目录的功能。但是可以通过修改源码解决跨站问题。
tar zxvf php-5.2.17.tar.gz 解压
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -fd php-5.2.17 -p1 php5.2.17打上php-fpm补丁,5.2不支持!
cd php-5.2.17
vim main/fopen_wrappers.c
找到234行,添加如下代码:
code
//nginx 5.2.17防止跨站
///*添加开始, add by 黄云建 QQ:22327635*/
char *env_doc_root;
env_doc_root = sapi_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC);
if(env_doc_root){
int res_root = php_check_specific_open_basedir(env_doc_root, path TSRMLS_CC);
efree(env_doc_root);
if (res_root == 0) {
return 0;
}
}
// 添加的内容结束
如图一所示
[attach]2530[/attach]
编译
./configure --prefix=/www/wdlinux/nginx_php-5.2.17 \--with-config-file-path=/www/wdlinux/nginx_php-5.2.17/etc \
--with-mysql=/www/wdlinux/mysql --with-mysqli=/www/wdlinux/mysql/bin/mysql_config \
--with-iconv=/usr \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-bz2 \
--with-libxml-dir=/usr \
--enable-xml --disable-rpath \
--enable-discard-path \
--enable-inline-optimization \
--with-curl --enable-mbregex \
--enable-mbstring \
--with-mcrypt=/usr \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-ftp \
--enable-sockets \
--enable-zip \
--enable-fastcgi \
--enable-fpm \
--with-fpm-conf=/www/wdlinux/etc/php-fpm.conf
make
make install
修改php.ini
open_basedir = "/tmp;/var/tmp;/proc"
重启service php-fpm restart 这个修改方式,很早的时候就有了,只是没实际应用过,不确定是否有影响,所以默认没加上 [b]回复 [url=http://wdlinux.cn/bbs/redirect.php?goto=findpost&pid=20046&ptid=5281]2#[/url] [i]admin[/i] [/b]
老大 求助您一个问题
[size=12px][table=98%]
[tr][td][color=#b52828]linux装了wd[/color]
[color=#b52828]安装phpwind9无法登陆 地址:www.tongren365.com[/color]
[color=#b52828]提示错误: [/color]Sorry, CSRF verification failed(token missing or incorrect),refresh to try again.
环境哪里配置的有问题? 该怎么做?[/td][/tr]
[/table][/size] [b]回复 [url=http://wdlinux.cn/bbs/redirect.php?goto=findpost&pid=20089&ptid=5281]3#[/url] [i]sanlang[/i] [/b]
是论坛首页不能登录? [b]回复 [url=http://wdlinux.cn/bbs/redirect.php?goto=findpost&pid=20139&ptid=5281]4#[/url] [i]marquis[/i] [/b]
解决了 [b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=20038&ptid=5281]1#[/url] [i]hackhyj[/i] [/b]
按照你的办法,一切都ok了。但是问题还没解决,webshell 还是可以访问所有的目录。
页:
[1]