<?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>DFdou&#039;s Blog &#187; wp-config.php</title>
	<atom:link href="http://nwhy.org/tag/wp-configphp/feed" rel="self" type="application/rss+xml" />
	<link>http://nwhy.org</link>
	<description>Life is short,Be yourself.</description>
	<lastBuildDate>Wed, 25 Aug 2010 05:26:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress-10步增加WP的后台安全性</title>
		<link>http://nwhy.org/wordpress-safety.html</link>
		<comments>http://nwhy.org/wordpress-safety.html#comments</comments>
		<pubDate>Wed, 04 Feb 2009 06:12:26 +0000</pubDate>
		<dc:creator>DFdou</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Safety]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Wp-admin]]></category>
		<category><![CDATA[wp-config.php]]></category>

		<guid isPermaLink="false">http://nwhy.org/?p=3592</guid>
		<description><![CDATA[翻译自"10 Steps To Protect The Admin Area In WordPress"，有兴趣的可以直接点击查看原文，以下内容较原文有很多删减。 Needs to protect: the administration area in WordPress Protect the administration area of your WordPress blo... ]]></description>
			<content:encoded><![CDATA[<p>翻译自"<a  href="http://www.smashingmagazine.com/2009/01/26/10-steps-to-protect-the-admin-area-in-wordpress/">10 Steps To Protect The Admin Area In WordPress</a>"，有兴趣的可以直接点击查看原文，以下内容较原文有很多删减。<br />
Needs to protect: the administration area in WordPress<br />
Protect the administration area of your WordPress blog.</p>
<p>To make an attack more difficult, you should perform the following actions manually. These solutions do not guarantee 100% security, but you can create effective stumbling blocks on a hacker’s way to the administration area.<br />
<strong>1. Rename and Upload the wordpress Folder<br />
重命名WordPress所在目录名</strong><br />
在v2.6之后，我们可以在后台修改WordPress文件所在目录，不过可惜的是，我们无法单独修改wp-admin文件夹的名称。<br />
不过有总比没有好啦。</p>
<p><strong>2. Extend the file wp-config.php<br />
扩展设置你的wp-config.php</strong><br />
在v2.7开始，我们可以设置以下几个安全参数：</p>
<pre class="brush: php">
define(&#039;AUTH_KEY&#039;, &#039;替换该字符串&#039;);
define(&#039;SECURE_AUTH_KEY&#039;, &#039;替换该字符串&#039;);
define(&#039;LOGGED_IN_KEY&#039;, &#039;替换该字符串&#039;);
define(&#039;NONCE_KEY&#039;, &#039;替换该字符串&#039;);
</pre>
<p>另外，还有$table_prefix参数，或者，你可以在里边加入</p>
<pre class="brush: php">define(’FORCE_SSL_ADMIN’, true);</pre>
<p>来增加登录的安全校验。<br />
你也可以学习其他系统的安全设置，关于改文件的设置可以参考<a  href="http://codex.wordpress.org/Editing_wp-config.php">WordPress Codex</a><br />
<span id="more-3592"></span><br />
<strong>3. Move the wp-config.php file<br />
移动wp-config.php文件</strong><br />
在v2.6之后，我们可以将wp-config.php文件移动到安装文件包外边……<br />
个人猜测这个应在是WordPress安装在子文件夹内的时候才会发生的状况。<br />
具体没有测试过，这段的原文如下：</p>
<blockquote><p>Also since version 2.6, WordPress allows you to move the wp-config.php file to a higher level. Because this system file contains by far more sensitive information than any other, and because it is difficult to access the parent file server level, it certainly makes sense to store it outside of the actual installation. WordPress automatically looks at the highest underlying index for the configuration settings file. Any attempt by users to adjust the path is thus useless.</p></blockquote>
<p><strong>4. Protect the wp-config.php file<br />
保护wp-config.php文件</strong><br />
这个需要主机支持，在.htaccess文件里增加下边的代码:</p>
<pre class="brush: php">
# protect wp-config.php
&lt;files wp-config.php&gt;
Order deny,allow
deny from all
&lt;/files&gt;
</pre>
<p><strong>5. Delete the admin User Account<br />
删除admin帐号</strong><br />
由于admin是内建帐号，这相当于告诉了别人帐号名，所以存在安全隐患，最简单的做法就是用admin帐号登录后，建立一个新帐号，然后提升为admin权限，接着用新帐号登录，删除掉admin帐号即可。</p>
<p><strong>6. Choose strong passwords<br />
使用强壮的密码，哈，不知道是不是该翻译成"强壮"?</strong><br />
这个就不多说了，尽量长，尽量复杂的组合，应该就可以了。</p>
<p><strong>7. Protect the wp-admin Directory<br />
保护wp-admin目录</strong><br />
这个需要在wp-admin目录里设置.htpasswd文件，具体的设置请参考：http://www.htaccesstools.com/htpasswd-generator，唉，杭州这里无法访问改url，估计被电信和谐了……</p>
<p><strong>8. Suppress Error Feedback on the Log-In Page<br />
禁止Login页的登录错误信息</strong><br />
这一点我觉得有点多余了吧，去除掉登录时候显示的登录错误信息……</p>
<pre class="brush: php">
add_filter(&#039;login_errors&#039;,create_function(&#039;$a&#039;, &#039;return null;&#039;));
</pre>
<p><strong>9. Restrict Erroneous Log-In Attempts<br />
限制登录尝试次数</strong><br />
这个挺有必要的，有2个解决方案：<br />
1.<a  href="http://www.bad-neighborhood.com/login-lockdown.html">Login LockDown</a><br />
2.<a  href="http://devel.kostdoktorn.se/limit-login-attempts/">Limit Login Attempts</a><br />
这2个插件都可以限制登录次数。</p>
<p><strong>10. Keep Software Up to Date<br />
保持WordPress的版本更新</strong><br />
最好是保持到最新的正式版本，个人建议哈……另外插件也要记得更新到最新版本。<br />
最后加一条，有些皮肤模板里边有人加了恶意代码…SO，请从正规网站下载皮肤...</p>
<h4  class="related_post_title">Some Related Posts</h4><ul class="related_post"><li>2009/07/06 -- <a  href="http://nwhy.org/wordpress-some-special-error.html" title="WordPress-一些奇怪的错误Some Special Error ">WordPress-一些奇怪的错误Some Special Error </a> (1)</li><li>2009/06/19 -- <a  href="http://nwhy.org/introduce-wordpress.html" title="介绍下WordPress ">介绍下WordPress </a> (1)</li><li>2009/06/04 -- <a  href="http://nwhy.org/wordpress-plugins-role-manage.html" title="15款WordPress角色权限管理插件 | 转载自帕兰映像">15款WordPress角色权限管理插件 | 转载自帕兰映像</a> (0)</li><li>2009/05/07 -- <a  href="http://nwhy.org/wordpress-plugins-wp-super-cache.html" title="WordPress Plugins-WP Super Cache使用介绍">WordPress Plugins-WP Super Cache使用介绍</a> (2)</li><li>2009/05/06 -- <a  href="http://nwhy.org/wordpress-cms-hacks-and-tricks.html" title="WordPress-CMS Hacks and Tricks">WordPress-CMS Hacks and Tricks</a> (4)</li><li>2009/03/28 -- <a  href="http://nwhy.org/wordpress-plugins-optimize_db.html" title="WordPress Plugins-Optimize DB">WordPress Plugins-Optimize DB</a> (0)</li><li>2009/02/06 -- <a  href="http://nwhy.org/wordpress-plugins-wp2twitter.html" title="WordPress Plugins-Wp-to-twitter">WordPress Plugins-Wp-to-twitter</a> (2)</li><li>2009/02/06 -- <a  href="http://nwhy.org/wordpress-plugins-fanfouportable.html" title="WordPress Plugins-Fanfouportable">WordPress Plugins-Fanfouportable</a> (0)</li><li>2009/02/04 -- <a  href="http://nwhy.org/wordpress-plugins-of-nwhyorg.html" title="WordPress Plugins-nwhy.org使用的插件列表">WordPress Plugins-nwhy.org使用的插件列表</a> (0)</li><li>2009/02/03 -- <a  href="http://nwhy.org/wordpress-plugins-twitter-updater.html" title="WordPress Plugins-Twitter Updater">WordPress Plugins-Twitter Updater</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://nwhy.org/wordpress-safety.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress-一个程序多个网站的配置</title>
		<link>http://nwhy.org/wordpress-multisites.html</link>
		<comments>http://nwhy.org/wordpress-multisites.html#comments</comments>
		<pubDate>Mon, 19 Jan 2009 05:44:54 +0000</pubDate>
		<dc:creator>DFdou</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Multisites]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp-config.php]]></category>

		<guid isPermaLink="false">http://nwhy.org/?p=3509</guid>
		<description><![CDATA[这个办法在网络版和本地的情况下同样适用，之所以要讲单机版的，是因为单机版的域名配置相对麻烦，还得修改Apache跟Host文件。本人愚笨，差不多找了好几天才找到办法解决这个问题，整理... ]]></description>
			<content:encoded><![CDATA[<p>这个办法在网络版和本地的情况下同样适用，之所以要讲单机版的，是因为单机版的域名配置相对麻烦，还得修改Apache跟Host文件。本人愚笨，差不多找了好几天才找到办法解决这个问题，整理了下分享一下，嘿嘿。<br />
如果是网络版多网站一个WordPress的操作请略过前2步，直接到wp-config.php配置部分。<br />
至于IIS服务器或Tomcat等其他服务器，咱不会……而且我相信，WordPress应该不会被安装在那些服务器下，哈哈。<br />
好，言归正传，我们先得配置Host文件，让域名有个指向。<br />
WIN2000和XP，Vista系统的Host文件的路径为：系统所在盘\Windows\System32\drivers\etc\下，WIN98的…自己找……<br />
用文本就可以打开了，在后边加上：</p>
<pre class="brush: html">
127.0.0.2       wp
127.0.0.3       wp1
127.0.0.4       wp2
#前边是ip地址，后边是访问路径，这样我们在访问wp的时候，系统会自动解析到127.0.0.2，下边的一次类推。
#PS：后边不要输入类似于df.dou等带“.”号的东西，会被解析成互联网地址，然后就被万恶的电信带到404页面去了……
#PS2：电信的404页面有MM图…
</pre>
<p>配置完Host文件记得保存，是不是挺简单呢～<br />
<span id="more-3509"></span><br />
接这配置Apache的httpd.conf，找个地方输入：</p>
<pre class="brush: html">
#由Apache来做域名的转向，D:\website\wp27all就是我们安装的WordPress的物理地址
  &lt;virtualhost 127.0.0.2&gt;
          DocumentRoot  D:\website\wp27all
          ServerName   wp
  &lt;/virtualhost&gt;  

  &lt;virtualhost 127.0.0.3&gt;
          DocumentRoot  D:\website\wp27all
          ServerName   wp1
  &lt;/virtualhost&gt;  

  &lt;virtualhost 127.0.0.4&gt;
          DocumentRoot  D:\website\wp27all
          ServerName   wp2
  &lt;/virtualhost&gt;
</pre>
<p>看吧，其实Apache配置起来也不难的～<br />
别急，还有最后一步，我们得配置下WordPress的wp-config.php文件来为各个网站分配数据库。<br />
为了方便，这里只使用一个数据库，而使用前缀来区别不同网站。<br />
wp-config.php：</p>
<pre class="brush: html">
/**
 * WordPress数据表前缀。
 *
 * 如果您有在同一数据库内安装多个 WordPress 的需求，请为每个 WordPress 设置不同的数据表前缀。
 * 前缀名只能为数字、字母加下划线。
 *
 *如果是网络版多网站一个WordPress，把wp，wp1，wp2更换成域名即可，如www.nwhy.org
 */
if($_SERVER[&quot;HTTP_HOST&quot;]==&quot;wp&quot;){
$table_prefix  = &#039;wp_&#039;;
}else if($_SERVER[&quot;HTTP_HOST&quot;]==&quot;wp1&quot;){
$table_prefix  = &#039;wp1_&#039;;
}else if($_SERVER[&quot;HTTP_HOST&quot;]==&quot;wp2&quot;){
$table_prefix  = &#039;wp2_&#039;;
}
</pre>
<p>到此，全部搞定，现在输入http://wp开始安装第一个WordPress吧～</p>
<h4  class="related_post_title">Some Related Posts</h4><ul class="related_post"><li>2009/02/04 -- <a  href="http://nwhy.org/wordpress-safety.html" title="WordPress-10步增加WP的后台安全性">WordPress-10步增加WP的后台安全性</a> (2)</li><li>2009/11/17 -- <a  href="http://nwhy.org/wordpress-theme-appcloud.html" title="WordPress-AppCloud主题">WordPress-AppCloud主题</a> (0)</li><li>2009/10/21 -- <a  href="http://nwhy.org/wordpress-tipz-theme-released.html" title="WordPress-Tipz Theme Released">WordPress-Tipz Theme Released</a> (4)</li><li>2009/07/06 -- <a  href="http://nwhy.org/wordpress-some-special-error.html" title="WordPress-一些奇怪的错误Some Special Error ">WordPress-一些奇怪的错误Some Special Error </a> (1)</li><li>2009/06/30 -- <a  href="http://nwhy.org/wordpress-second-development-function.html" title="WordPress-2次开发常用函数">WordPress-2次开发常用函数</a> (0)</li><li>2009/06/29 -- <a  href="http://nwhy.org/wordpress-create-theme.html" title="WordPress-Theme的制作">WordPress-Theme的制作</a> (0)</li><li>2009/06/22 -- <a  href="http://nwhy.org/wordpress-themes-branfordmagazine.html" title="WordPress Themes-BranfordMagazine">WordPress Themes-BranfordMagazine</a> (0)</li><li>2009/06/19 -- <a  href="http://nwhy.org/introduce-wordpress.html" title="介绍下WordPress ">介绍下WordPress </a> (1)</li><li>2009/06/04 -- <a  href="http://nwhy.org/wordpress-plugins-role-manage.html" title="15款WordPress角色权限管理插件 | 转载自帕兰映像">15款WordPress角色权限管理插件 | 转载自帕兰映像</a> (0)</li><li>2009/05/21 -- <a  href="http://nwhy.org/wordpress-100-themes-for-2009.html" title="WordPress-100 Amazing Free Wordpress Themes for 2009">WordPress-100 Amazing Free Wordpress Themes for 2009</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://nwhy.org/wordpress-multisites.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
