<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>系统运维 &#187; 目录跨站</title>
	<atom:link href="http://www.osyunwei.com/archives/tag/%E7%9B%AE%E5%BD%95%E8%B7%A8%E7%AB%99/feed" rel="self" type="application/rss+xml" />
	<link>https://www.osyunwei.com</link>
	<description>国产化OS/AnolisOS/openEuler/RHEL/CentOS/Rocky Linux/Debian/Ubuntu Linux FreeBSD 服务器教程 &#124; Windows Server 2003/2008/2012/2016/2019/2022/2025服务器教程</description>
	<lastBuildDate>Wed, 01 Apr 2026 08:27:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>解决Nginx+php（php 5.3.0及其以上版本）防止目录跨站问题</title>
		<link>https://www.osyunwei.com/archives/5404.html</link>
		<comments>https://www.osyunwei.com/archives/5404.html#comments</comments>
		<pubDate>Wed, 17 Oct 2012 03:53:24 +0000</pubDate>
		<dc:creator>qihang01</dc:creator>
				<category><![CDATA[LNMP]]></category>
		<category><![CDATA[php跨站]]></category>
		<category><![CDATA[目录跨站]]></category>

		<guid isPermaLink="false">http://www.osyunwei.com/?p=5404</guid>
		<description><![CDATA[说明： 站点一：bbs.osyunwei.com 程序目录：/data/wwwroot/bbs.osyunwei.com 如下图所示： 站点二：sns.osyunwei.com 程序目录：/data/wwwroot/sns.osyunwei.com 如下图所示： php.ini配置文件路径：/etc/php.ini php版本：php 5.3.16（此方法只针对php 5.3.0及其以上版本有效） 问题： 在站点一的目录下面上传PHP管理工具（请自行搜索下载），通过此工具可以浏览到站点二的目录内容，出现跨站、跨目录浏览 如下图所示： 系统运维 www.osyunwei.com 温馨提醒：qihang01原创内容©版权所有,转载请注明出处及原文链接 解决办法： 操作步骤 vi /etc/php.ini #编辑,在最后添加以下代码，修改open_basedir的目录为站点路径 [HOST=bbs.osyunwei.com] [PATH=/data/wwwroot/bbs.osyunwei.com] open_basedir=/data/wwwroot/bbs.osyunwei.com/:/tmp/ [HOST=sns.osyunwei.com] [PATH=/data/wwwroot/sns.osyunwei.com] open_basedir=/data/wwwroot/sns.osyunwei.com/:/tmp/ :wq! #保存退出 备注：如果有多个站点，可以依次添加 service nginx restart #重启nginx service php-fpm restart #重启php-fpm 测试：如下图所示 系统运维 www.osyunwei.com 温馨提醒：qihang01原创内容©版权所有,转载请注明出处及原文链接 可以看到，通过站点一中的PHP管理工具已经不能访问站点二中的目录了，问题解决！ 扩展阅读： [HOST]配置段可用的参数： display_errors = On short_open_tag = On expose_php = Off [...]<p><a rel="bookmark" href="https://www.osyunwei.com/archives/5404.html" target="_blank">查看全文</a></p>]]></description>
		<wfw:commentRss>https://www.osyunwei.com/archives/5404.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
