<?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>wp-config.php の編集 | Webサイトに必要なことと道具</title>
	<atom:link href="https://xn--ecka7j.biz/tag/wp-config-php-file/feed/" rel="self" type="application/rss+xml" />
	<link>https://xn--ecka7j.biz</link>
	<description>セキュリティ対策、最適化、ツール、工作</description>
	<lastBuildDate>Sat, 07 Sep 2024 00:07:32 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://xn--ecka7j.biz/wp-content/uploads/2020/02/cropped-ogt-512-512-024-068-32x32.png</url>
	<title>wp-config.php の編集 | Webサイトに必要なことと道具</title>
	<link>https://xn--ecka7j.biz</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>セキュリティ：あなたのWordPressサイトのセキュリティを高める</title>
		<link>https://xn--ecka7j.biz/security/388/</link>
		
		<dc:creator><![CDATA[Jun-N]]></dc:creator>
		<pubDate>Thu, 12 Mar 2020 05:06:10 +0000</pubDate>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[セキュリティ]]></category>
		<category><![CDATA[パーミッションの設定]]></category>
		<category><![CDATA[.htaccessファイル]]></category>
		<category><![CDATA[wp-config.phpファイル]]></category>
		<category><![CDATA[外部からのアクセスを禁止]]></category>
		<category><![CDATA[大事なこと]]></category>
		<guid isPermaLink="false">https://xn--ecka7j.biz/?p=388</guid>

					<description><![CDATA[WordPressサイトのセキュリティを高める wp-config.phpファイルを外部からのアクセス不可に設定する方法。.htaccessファイルに記載して外部からのアクセスを禁止にする。具体的な記入例と記載後の検証結 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="600" height="400" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-07-600-400-356-1.png" alt="" class="wp-image-426" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-07-600-400-356-1.png 600w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-07-600-400-356-1-500x333.png 500w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-07-600-400-356-1-300x200.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-07-600-400-356-1-250x167.png 250w" sizes="(max-width: 600px) 100vw, 600px" /></figure>



<p>WordPressサイトのセキュリティを高める</p>



<p><strong>wp-config.phpファイル</strong>を外部からのアクセス不可に設定する方法。<strong>.htaccess</strong>ファイルに記載して外部からのアクセスを禁止にする。具体的な記入例と記載後の検証結果の例をお伝えします。 WordPressサイトをお持ちの<strong>あなたにとっても大事なこと</strong>です。</p>




  <div id="toc" class="toc tnt-none toc-center tnt-none border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ul class="toc-list open"><li><a href="#toc1" tabindex="0">セキュリティ（Security）を高める（切り出し編）</a><ul><li><a href="#toc2" tabindex="0">「wp-config.php」ファイルを外部からのアクセス不可に設定する</a><ul><li><a href="#toc3" tabindex="0">「.htaccess」ファイルに追記する</a></li><li><a href="#toc4" tabindex="0">実際のサーバ環境（XSERVER）のWebFTPでメンテナンス</a></li></ul></li><li><a href="#toc5" tabindex="0">設置後検証</a><ul><li><a href="#toc6" tabindex="0">403画面になって欲しかったけど</a></li><li><a href="#toc7" tabindex="0">なぜ？を調べてみた「403でなく画面が真っ白」で検索しても・・・</a></li><li><a href="#toc8" tabindex="0">あなたが、ご存知なら</a></li></ul></li></ul></li></ul>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">セキュリティ（Security）を高める（切り出し編）</span></h2>



<p><a href="https://イイネ.biz/security/150/#toc8">以前の記事で、「wp-config.php」のファイルのセキュリティについて書いた</a>のですが、</p>



<p>　テーブルのリネーム(wp-プイレイックスの変更)など、<span class="marker-under">色々な設定と織り交ぜて記載</span>している為（分かりにくいかもしてませんので）</p>



<p>今回は<span class="marker-under-blue">この部分の設定だけ切り出してお伝え</span>します。</p>



<h3 class="wp-block-heading"><span id="toc2">「wp-config.php」ファイルを外部からのアクセス不可に設定する</span></h3>



<figure class="wp-block-image size-large"><img decoding="async" width="600" height="400" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-16-600-400-076.png" alt="WordPressのセキュリティ対策" class="wp-image-389" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-16-600-400-076.png 600w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-16-600-400-076-500x333.png 500w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-16-600-400-076-300x200.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-16-600-400-076-250x167.png 250w" sizes="(max-width: 600px) 100vw, 600px" /></figure>



<p>データベースのアカウント情報が記載されている「<strong>wp-config.php</strong>」のファイルは、WordPressを利用する上で、最も重要で、最もセキュリティレベルを高く設定しなけ<span class="marker-under">ればいけないファイルです</span>。</p>



<p>（これも以前の記事にも書いたことですが、大事なことなので、改めて書いています）</p>



<p><br>
このファイルが、攻撃者の手に渡ってしまったら、データベースが直に操作されてしまう危険性があります。</p>



<p>そのため、<strong><span class="bold-red">外部からのアクセスを不可に設定</span></strong>し、<strong>パーミッションも厳しく設定する</strong>必要があります。（今回の例では触れませんが、パーミッションは600に設定しています）</p>



<h4 class="wp-block-heading"><span id="toc3">「.htaccess」ファイルに追記する</span></h4>



<figure class="wp-block-image size-large"><img decoding="async" width="600" height="697" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-wp-config-600-697-048-284.png" alt="注意" class="wp-image-382" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-wp-config-600-697-048-284.png 600w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-wp-config-600-697-048-284-500x581.png 500w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-wp-config-600-697-048-284-300x349.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-wp-config-600-697-048-284-250x290.png 250w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption>「wp-config.php」と同じ階層の「.htaccess※」ファイル</figcaption></figure>



<p>「<strong>wp-config.php</strong>」と<strong>同じ階層</strong>の「<strong>.htaccess<sup><span class="bold-red">※</span></sup></strong>」ファイルに、下記を入力してください。<br> <strong><span class="bold-red">※</span></strong><a>. </a>分散設定ファイル：<strong>ドット</strong>・<strong>エイチ</strong>・<strong>ティ</strong>・<strong>アクセス</strong> ファイルは、Apache（アパッチ）を用いたWebサーバにおいて、ディレクトリ単位でサーバの挙動の決定を設置できる設定ファイル</p>



<p>&lt;files wp-config<span class="red">\</span>.php&gt;</p>



<p>order allow,deny</p>



<p>deny from all</p>



<p>&lt;/files&gt;</p>



<p>　⇧<span class="red">￥</span>はサーバ環境では<span class="red">バックスラッシュ</span>（Unix制御文字として、Linuxも）です。</p>



<p>これで、外部からのアクセスは不可能になります。</p>



<p>「<strong>.htaccess</strong>」ファイルは、様々な設定をすることができます。<br>設定の範囲を後から分かりやすくするためには、<br>前後にコメント(<span class="red">#</span>で始まる)を挟むのもよいかも知れません<br>（多くのプラグインもセットアップでその様な注釈を自動で入れてくれます）</p>



<p>例えば、</p>



<p>#Begin wp-config.php Security
-2020/03/12</p>



<p>#END wp-config.php Security
-2020/03/12</p>



<p>の様に</p>



<h4 class="wp-block-heading"><span id="toc4">実際のサーバ環境（XSERVER）のWebFTPでメンテナンス</span></h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="600" height="199" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-600-199-044.png" alt="XSERVER" class="wp-image-385" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-600-199-044.png 600w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-600-199-044-500x166.png 500w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-600-199-044-300x100.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/htaccess-600-199-044-250x83.png 250w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption>WebFTPで追記</figcaption></figure>



<ul class="wp-block-list"><li>.htaccessへの追記です。</li><li><span class="marker-under">既にある記載の変更・削除は、絶対に行わない様に注意して行ってください</span></li></ul>



<h3 class="wp-block-heading"><span id="toc5">設置後検証</span></h3>



<p><a href="https://イイネ.biz/wp-config.php/">https://イイネ.biz/wp-config.php/</a> では、</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="400" height="300" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/white-400-300-016.png" alt="403" class="wp-image-387" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/white-400-300-016.png 400w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/white-400-300-016-300x225.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/white-400-300-016-250x188.png 250w" sizes="(max-width: 400px) 100vw, 400px" /><figcaption>403 Forbiddenにならず、画面が真っ白！</figcaption></figure>



<h5 class="wp-block-heading"> ChromeもFirefoxでも、Edgeでもみんな真っ白な画面</h5>



<p>筆者が検証を行ったところ、⇧ 403<sup>※</sup>エラーでなく真っ白の何もない画面になります？</p>



<h4 class="wp-block-heading"><span id="toc6">403画面になって欲しかったけど</span></h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="400" height="300" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/error403-400-300-080.png" alt="403" class="wp-image-386" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/error403-400-300-080.png 400w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/error403-400-300-080-300x225.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/error403-400-300-080-250x188.png 250w" sizes="(max-width: 400px) 100vw, 400px" /><figcaption>HTTP 403、またはエラーメッセージ Forbidden（「閲覧禁止」「禁止されています」</figcaption></figure>



<p>本来、<strong><span class="bold-blue">“</span>HTTP 403</strong>、またはエラーメッセージ <strong>Forbidden</strong>（「閲覧禁止」「禁止されています」の意）は、HTTPステータスコードの一つ。 <br>　ページが存在するものの、特定のアクセス者にページを表示する権限が付与されず、アクセスが拒否されたことを示すもの。<span class="bold-blue">”</span></p>



<p>403になって欲しかった（XSERVERの場合）のだけど</p>



<h4 class="wp-block-heading"><span id="toc7">なぜ？を調べてみた「403でなく画面が真っ白」で検索しても・・・</span></h4>



<h5 class="wp-block-heading">403と関係している様な記載はみかけるものの、</h5>



<p>「画面が真っ白に」では、どの記載も・どれも当てはまらない。</p>



<h5 class="wp-block-heading"><strong>「意図した内容とは<span class="bold-red">ちがった</span>もののこれはこれで良いか！」と居直りぎみ</strong></h5>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="600" height="400" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-13-600-400-072.png" alt="Website" class="wp-image-380" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-13-600-400-072.png 600w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-13-600-400-072-500x333.png 500w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-13-600-400-072-300x200.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-13-600-400-072-250x167.png 250w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption>WordPressのセキュリティ対策</figcaption></figure>



<p><strong>もちろん<span class="marker-under-blue">ちゃんとしたURL入力では、正常に操作もできます</span>ので。</strong></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="600" height="400" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-17-600-400-076.png" alt="wordpress" class="wp-image-381" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-17-600-400-076.png 600w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-17-600-400-076-500x333.png 500w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-17-600-400-076-300x200.png 300w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security-17-600-400-076-250x167.png 250w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption>セキュリティ対策</figcaption></figure>



<h4 class="wp-block-heading"><span id="toc8">あなたが、ご存知なら</span></h4>



<p>あなたが、403でなく真っ白になる理由・原因をご存知ならコメント戴けると嬉しいです。</p>



<div class="wp-block-image"><figure class="alignright size-large"><img loading="lazy" decoding="async" width="179" height="179" src="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security_action-0179-0179-0008-0032.png" alt="セキュリティ対策自己宣言" class="wp-image-269" srcset="https://xn--ecka7j.biz/wp-content/uploads/2020/03/security_action-0179-0179-0008-0032.png 179w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security_action-0179-0179-0008-0032-100x100.png 100w, https://xn--ecka7j.biz/wp-content/uploads/2020/03/security_action-0179-0179-0008-0032-150x150.png 150w" sizes="(max-width: 179px) 100vw, 179px" /><figcaption>アルファ・ＩＴＣは、セキュリティ対策自己宣言二つ星を宣言しました</figcaption></figure></div>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
