<?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>Serendip &#187; server</title>
	<atom:link href="http://www.serendip.ws/archives/tag/server/feed" rel="self" type="application/rss+xml" />
	<link>http://www.serendip.ws</link>
	<description>Webデザイン・プログラミング</description>
	<lastBuildDate>Fri, 10 Feb 2012 05:33:58 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Mac Ports でインストールした Apache2 の自動起動</title>
		<link>http://www.serendip.ws/archives/5288</link>
		<comments>http://www.serendip.ws/archives/5288#comments</comments>
		<pubDate>Sat, 04 Dec 2010 01:40:02 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=5288</guid>
		<description><![CDATA[Mac Ports でインストールした Apache2 が、以前までちゃんと自動起動していたのに最近自動起動しなくなってしまった。 どうも、OSX のアップデートをしたあたりから自動起動しなくなったような気がする。 そこ [...]]]></description>
			<content:encoded><![CDATA[<p>Mac Ports でインストールした Apache2 が、以前までちゃんと自動起動していたのに最近自動起動しなくなってしまった。<br />
どうも、OSX のアップデートをしたあたりから自動起動しなくなったような気がする。</p>
<p>そこで、<code>launchctl</code> コマンドで plist のロードをやり直してみたが、既にロードされていた。<br />
だけど、Apache2 は起動していない&#8230;</p>
<pre>$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
org.macports.apache2: Already loaded
</pre>
<p>一旦 plist をアンロードしてから再ロードすると Apache2 は起動するが、Mac を再起動すると Apache2 は自動起動してくれない。</p>
<pre>$ sudo launchctl unload -w /Library/LaunchDaemons/org.macports.apache2.plist
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist</pre>
<p>いろいろ調べてみると、どうやら自分で追加した Apache2 の設定の <code>ServerName</code> 項目が原因のようなので、/opt/local/apache2/conf/httpd.conf の <code>ServerName</code> 項目をコメントアウトしてから Mac を再起動してみると無事 Apache2 が自動起動した。</p>
<p>参考：<a href="http://old.nabble.com/Apache-not-starting-at-boot-td17321181.html" class="out" rel="external">Old Nabble &#8211; MacPorts &#8211; Users &#8211; Apache not starting at boot</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/5288/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OSX の Apache2 で httpd: Could not reliably determine the server&#8217;s fully qualified domain name のエラーメッセージが出る</title>
		<link>http://www.serendip.ws/archives/4720</link>
		<comments>http://www.serendip.ws/archives/4720#comments</comments>
		<pubDate>Wed, 14 Apr 2010 00:57:53 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=4720</guid>
		<description><![CDATA[いつ頃からか、MacPorts(Mac OSX Snow Leopard) からインストールして使用している Apache2 で、スタート時に以下のようなエラーメッセージが出るようになった。 $ sudo /opt/lo [...]]]></description>
			<content:encoded><![CDATA[<p>いつ頃からか、MacPorts(Mac OSX Snow Leopard) からインストールして使用している Apache2 で、スタート時に以下のようなエラーメッセージが出るようになった。</p>
<pre>$ sudo /opt/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using <var>myhostname</var> for ServerName
</pre>
<p>そういえば、Mac ではホスト名の設定を『システム環境設定』の『共有』からしか行っていなかった。</p>
<p>そこで、Apache2 の設定ファイル /opt/local/apache2/conf/httpd.conf に <code>ServerName</code> の設定を追加する。</p>
<pre>$ sudo vi /opt/local/apache2/conf/httpd.conf

<span class="Comment"># httpd.conf の編集</span>
<span class="Comment"># 以下の行を追加する</span>
<span class="Identifier">ServerName</span> <var>myhostname</var>:80
</pre>
<p>設定変更後 Apache2 を再起動させると、起動時のエラーメッセージは表示されなくなった。</p>
<pre>$ sudo /opt/local/apache2/bin/apachectl restart
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/4720/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>サイトのメンテナンスを行う際の .htaccess 設定</title>
		<link>http://www.serendip.ws/archives/4277</link>
		<comments>http://www.serendip.ws/archives/4277#comments</comments>
		<pubDate>Wed, 03 Feb 2010 11:31:45 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=4277</guid>
		<description><![CDATA[サイトのメンテナンスを行う際に、訪問者にはメンテナンス中であることを示す画面 /maintenance/index.html を表示し、検索ロボットには 503 HTTPステータスコードを返す .htaccess の設定 [...]]]></description>
			<content:encoded><![CDATA[<p>サイトのメンテナンスを行う際に、訪問者にはメンテナンス中であることを示す画面 /maintenance/index.html を表示し、検索ロボットには <code>503</code> <a href="http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89" class="out">HTTPステータスコード</a>を返す .htaccess の設定方法。</p>
<p>メンテナンス画面表示用のファイルを配置するディレクトリ /maintenance を作る。</p>
<p>サーバにメンテナンス中を示すページのファイル /maintenance/index.html を配置する。</p>
<p>メンテナンス中ページに画像を表示する場合は画像ファイル /maintenance/maintenance.png を必要に応じて配置する。</p>
<p><code>503</code> ステータスコード（サービス利用不可）を返し、/maintenance/index.html の内容を表示させるために、以下の PHP スクリプト /maintenance/503.php を配置する。</p>
<pre><span class="Special">&lt;?php</span>
<span class="Identifier">header</span> <span class="Special">(</span>'<span class="Constant">HTTP/1.0 503 Service Temporarily Unavailable</span>'<span class="Special">)</span>;
<span class="Identifier">readfile</span><span class="Special">(</span><span class="Identifier">dirname</span><span class="Special">(</span><span class="Constant">__FILE__</span><span class="Special">)</span> <span class="Statement">.</span> '<span class="Constant">/index.html</span>'<span class="Special">)</span>;
<span class="Special">?&gt;</span>
</pre>
<p>メンテナンスを行うディレクトリに、以下の記述の .htaccess ファイルを配置する。<br />
メンテナンス作業者の IP アドレスを記述しておくと、作業者は通常の画面表示を確認できる。</p>
<pre><span class="Identifier">RewriteEngine</span> <span class="Constant">On</span>
<span class="Identifier">RewriteCond</span> %{REMOTE_ADDR} !=192.168.0.2
<span class="Identifier">RewriteCond</span> %{REQUEST_URI} !=/maintenance/503.php
<span class="Identifier">RewriteCond</span> %{REQUEST_URI} !=/maintenance/maintenance.png
<span class="Identifier">RewriteRule</span> ^.*$ /maintenance/503.php [L]
</pre>
<p>メンテナンス用ファイルを検索クローラーにキャッシュされないように、以下の記述を robot.txt に加える。</p>
<pre>User-Agent: *
Disallow: /maintenance/
</pre>
<p>これで、サイトメンテナンス中のページを検索クローラーにキャッシュされずに、訪問者にはメンテナンス中であることを示すページを表示することができる。</p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/maintenance_screenshot_001.png" alt="メンテナンス画面例 Screenshot" title="メンテナンス画面例 Screenshot" width="504" height="451" class="size-full wp-image-4278" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/4277/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 8.04 に Apache2, PHP5, MySQL をインストールする</title>
		<link>http://www.serendip.ws/archives/3255</link>
		<comments>http://www.serendip.ws/archives/3255#comments</comments>
		<pubDate>Sun, 11 Oct 2009 14:09:28 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=3255</guid>
		<description><![CDATA[Apache2 のインストール $ sudo aptitude install apache2 デフォルトの文字コードを UTF-8 にする $ sudo vi /etc/apache2/conf.d/charset # [...]]]></description>
			<content:encoded><![CDATA[<h3>Apache2 のインストール</h3>
<pre>$ sudo aptitude install apache2
</pre>
<h3>デフォルトの文字コードを UTF-8 にする</h3>
<pre>$ sudo vi /etc/apache2/conf.d/charset
<span class="Comment"># 以下の行のコメントアウトを解除する。</span>
<span class="Identifier">AddDefaultCharset</span> UTF-8
</pre>
<h3>サイト共通のディレクトリ設定をする</h3>
<p>CGI を使用可能に、ファイルの一覧表示は行わない、.htaccess 設定の上書きを可能にする。</p>
<pre>$ sudo vi /etc/apache2/conf.d/directory_settings
<span class="Comment"># 以下の記述を追加する。</span>
<span class="Statement">&lt;Directory</span><span class="Constant"> /</span><span class="Statement">&gt;</span>
    <span class="Identifier">Options</span> <span class="Constant">All</span>
    <span class="Identifier">Options</span> <span class="Constant">-Indexes</span>
    <span class="Identifier">AllowOverride</span> <span class="Constant">All</span>
<span class="Special">    Order </span><span class="Constant">allow</span><span class="Special">,</span><span class="Constant">deny</span>
    <span class="PreProc">allow from </span><span class="Identifier">all</span>
<span class="Statement">&lt;/Directory&gt;</span>
</pre>
<h3>CGI を使用可能にする</h3>
<pre>$ sudo vi /etc/apache2/conf.d/enable_cgi
<span class="Comment"># 以下の記述を追加する。</span>
<span class="Identifier">AddHandler</span> cgi-script .cgi
</pre>
<p>設定を行ったら Apache2 を再起動する</p>
<pre>$ sudo /etc/init.d/apache2 restart
</pre>
<h3>PHP5 のインストール</h3>
<pre>$ sudo aptitude install php5
</pre>
<p>設定を行ったら Apache2 を再起動する</p>
<pre>$ sudo /etc/init.d/apache2 restart
</pre>
<h3>MySQL のインストール</h3>
<p>インストール作業中に MySQL での root パスワード設定を求められる。</p>
<pre>$ sudo aptitude install mysql-server
</pre>
<p>PHP5 の MySQL モジュールもインストールする。</p>
<pre>$ sudo aptitude install php5-mysql
</pre>
<p>インストール後 Apache2 を再起動する</p>
<pre>$ sudo /etc/init.d/apache2 restart
</pre>
<p><code>phpinfo()</code> で MySQL のインストールを確認して完了。</p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/phpinfo_ubuntu_20091006_001.png" alt="phpinfo での MySQL 情報" title="phpinfo での MySQL 情報" width="500" height="252" class="size-full wp-image-3258" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/3255/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache で .htaccess を使用する</title>
		<link>http://www.serendip.ws/archives/3220</link>
		<comments>http://www.serendip.ws/archives/3220#comments</comments>
		<pubDate>Fri, 09 Oct 2009 11:31:13 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=3220</guid>
		<description><![CDATA[.htaccess が使えるように apache2 の httpd.conf を設定する。 $ sudo vi /opt/local/apache2/conf/httpd.conf &#60;Directory &#038;quot [...]]]></description>
			<content:encoded><![CDATA[<p>.htaccess が使えるように apache2 の httpd.conf を設定する。</p>
<pre>$ sudo vi /opt/local/apache2/conf/httpd.conf
</pre>
<pre><span class="Statement">&lt;Directory</span><span class="Constant"> &quot;/opt/local/apache2/htdocs&quot;</span><span class="Statement">&gt;</span>
    <span class="Comment"># 省略 ...</span>
    <span class="Comment"># AllowOverride None</span>
    <span class="Comment"># ↓ 以下のように All に変更する。</span>
    <span class="Identifier">AllowOverride</span> <span class="Constant">All</span>
    <span class="Comment"># 省略 ...</span>
<span class="Statement">&lt;/Directory&gt;</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/3220/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

