<?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>Sun Limited Mt. &#187; apache</title>
	<atom:link href="http://blog.syuhari.jp/archives/category/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.syuhari.jp</link>
	<description>I love iPhone, CakePHP and WordPress.</description>
	<lastBuildDate>Thu, 20 Oct 2011 19:36:15 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Apache + OpenSSL</title>
		<link>http://blog.syuhari.jp/archives/1046</link>
		<comments>http://blog.syuhari.jp/archives/1046#comments</comments>
		<pubDate>Sat, 10 Jan 2009 00:31:42 +0000</pubDate>
		<dc:creator>matsuura</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[CSR]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.syuhari.jp/blog/?p=1046</guid>
		<description><![CDATA[Apache + OpenSSL の設定をしたときのメモです。以下のサイトを参考にしました。 Apache(2.0)日本語マニュアル &#8211; The Japanese manual of Apache HTTP Server 2.0 秘密鍵、CSR 作成 秘密鍵（プライベートキー）を作成します。 パスフレーズのある秘密鍵を作成する。 $ openssl genrsa -des3 -out server.key 1024 パスフレーズのない秘密鍵を作成する。 $ openssl genrsa -out server.key 1024 パスフレーズを付けた場合は絶対にパスフレーズを忘れないこと。Apache を起動する際にパスフレーズを聞かれます。 CSR を作成する。 $ openssl req -new -key server.key -out server.csr 作成した CSR は下記コマンドで確認できる。 $ openssl req -noout -text -in server.csr 証明書を発行してもらう [...]]]></description>
			<content:encoded><![CDATA[<p>Apache + OpenSSL の設定をしたときのメモです。以下のサイトを参考にしました。<br />
<a href="http://www.pinkdragon.net/doc_lib/contents/ja/apache_2_0_man/ssl/ssl_faq.html" target="_blank" class="liexternal">Apache(2.0)日本語マニュアル &#8211; The Japanese manual of Apache HTTP Server 2.0</a><br />
<span id="more-1046"></span></p>
<h4>秘密鍵、CSR 作成</h4>
<p>秘密鍵（プライベートキー）を作成します。</p>
<p>パスフレーズのある秘密鍵を作成する。</p>
<pre class="shell">
$ openssl genrsa -des3 -out server.key 1024
</pre>
<p>パスフレーズのない秘密鍵を作成する。</p>
<pre class="shell">
$ openssl genrsa -out server.key 1024
</pre>
<p>パスフレーズを付けた場合は絶対にパスフレーズを忘れないこと。Apache を起動する際にパスフレーズを聞かれます。</p>
<p>CSR を作成する。</p>
<pre class="shell">
$ openssl req -new -key server.key -out server.csr
</pre>
<p>作成した CSR は下記コマンドで確認できる。</p>
<pre class="shell">
$ openssl req -noout -text -in server.csr
</pre>
<h4>証明書を発行してもらう</h4>
<p>Verisign や geoTrust のようなところで証明書を発行してもらう。<br />
発行してもらった証明書は下記コマンドで確認できる。</p>
<pre class="shell">
$ openssl x509 -noout -text -in server.crt
</pre>
<h4>httpd.conf の変更</h4>
<p>httpd.conf に証明書と秘密鍵の場所を指定する</p>
<pre class="shell">
SSLCertificateFile    /path/to/this/server.crt
SSLCertificateKeyFile /path/to/this/server.key
</pre>
<p>Apache の再起動を忘れずに！</p>
<h4>秘密鍵と証明書がマッチしていることを確認する方法</h4>
<p>それぞれの内容を表示して確認</p>
<pre class="shell">
$ openssl x509 -noout -text -in server.crt
$ openssl rsa -noout -text -in server.key
</pre>
<p>ただこれだと面倒くさい</p>
<p>md5 の値を比較して確認</p>
<pre class="shell">
$ openssl x509 -noout -modulus -in server.crt | openssl md5
$ openssl rsa -noout -modulus -in server.key | openssl md5
</pre>
<p>上記コマンドで出力された値がそれぞれ等しければ秘密鍵と証明書がマッチしています。</p>
<h4>秘密鍵のパスフレーズを変更する方法</h4>
<p>秘密鍵のパスフレーズを変更する</p>
<pre class="shell">
$ openssl rsa -des3 -in server.key -out server.key.new
$ mv server.key.new server.key
</pre>
<p>最初に現在のパスフレーズを聞かるので入力する。次に新しいパスフレーズを聞かれるので入力する。当然ですが変更前のパスフレーズを忘れた場合は変更できません。</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.syuhari.jp%2Farchives%2F1046&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://blog.syuhari.jp/archives/1046/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AWStats で URL だけでなくページタイトルも表示させる方法</title>
		<link>http://blog.syuhari.jp/archives/687</link>
		<comments>http://blog.syuhari.jp/archives/687#comments</comments>
		<pubDate>Thu, 18 Sep 2008 05:37:47 +0000</pubDate>
		<dc:creator>matsuura</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[age]]></category>
		<category><![CDATA[AWStats]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://www.syuhari.jp/blog/?p=687</guid>
		<description><![CDATA[AWStats というアクセス解析があります。Apache の生ログを解析します。これを使用すると色々な解析ができるのですが、その中で URL 毎にアクセス数を表示する機能があります。しかし URL のみでは分かりづらいので一緒にページタイトルを表示する方法です。 設定ファイルは awstats.example.com.conf 、ドメインは example.com とします。 設定ファイルの変更 設定ファイル awstats.example.com.conf の #LoadPlugin=”urlalias” のコメントをはずす。 タイトル取得プラグインスクリプトの設定 タイトル取得プラグイン awstats_dir/tools/urlaliasbuilder.pl を少し変更します。 Jcode]の追加 LWP:UserAgent の下あたりに use Jcode; を追加する use LWP::UserAgent; use Jcode; 下記の行を検索して my $newAliasEntry = &#038;Generate_Alias_List_Entry($newAlias); $fileOutput .= $newAliasEntry . “\n”; この2行の間に追加 Jcode での変換処理を追加する my $newAliasEntry = &#038;Generate_Alias_List_Entry($newAlias); Jcode::convert(\$newAliasEntry, ‘utf8′); $fileOutput .= $newAliasEntry . [...]]]></description>
			<content:encoded><![CDATA[<p>AWStats というアクセス解析があります。Apache の生ログを解析します。これを使用すると色々な解析ができるのですが、その中で URL 毎にアクセス数を表示する機能があります。しかし URL のみでは分かりづらいので一緒にページタイトルを表示する方法です。</p>
<p>設定ファイルは awstats.example.com.conf 、ドメインは example.com とします。<br />
<span id="more-687"></span></p>
<h4>設定ファイルの変更</h4>
<p>設定ファイル awstats.example.com.conf の</p>
<pre class="php" name="code">#LoadPlugin=”urlalias”</pre>
<p>のコメントをはずす。</p>
<h4>タイトル取得プラグインスクリプトの設定</h4>
<p>タイトル取得プラグイン awstats_dir/tools/urlaliasbuilder.pl を少し変更します。</p>
<h5>Jcode]の追加</h5>
<p>LWP:UserAgent の下あたりに use Jcode; を追加する</p>
<pre class="php" name="code">use LWP::UserAgent;
use Jcode;
</pre>
<p>下記の行を検索して</p>
<pre class="php" name="code">
my $newAliasEntry = &#038;Generate_Alias_List_Entry($newAlias);
$fileOutput .= $newAliasEntry . “\n”;
</pre>
<p>この2行の間に追加 Jcode での変換処理を追加する</p>
<pre class="php" name="code">
my $newAliasEntry = &#038;Generate_Alias_List_Entry($newAlias);
Jcode::convert(\$newAliasEntry, ‘utf8′);
$fileOutput .= $newAliasEntry . “\n”;
</pre>
<h4>cron の設定</h4>
<p>cron で定期的に URL とページタイトルの対応表を作成します。この対応表を使って AWStats が URL にタイトルを入れてくれます。</p>
<pre class="shell">
/path/to/awstats/urlaliasbuilder.pl -site=example.com -urlaliasfile=/path/to/awstats_dir/urlalias.example.com.txt
</pre>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.syuhari.jp%2Farchives%2F687&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://blog.syuhari.jp/archives/687/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MacBook に開発環境を入れる</title>
		<link>http://blog.syuhari.jp/archives/554</link>
		<comments>http://blog.syuhari.jp/archives/554#comments</comments>
		<pubDate>Tue, 29 Jul 2008 05:38:59 +0000</pubDate>
		<dc:creator>matsuura</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[age]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[ec]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[hatena]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[ini]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[LAN]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[URL]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://www.syuhari.jp/blog/?p=554</guid>
		<description><![CDATA[Apache + MySQL + PHP を MacPorts で入れてみました。 Apache のインストール $ sudo port install apache2 しかし、sqlite3 のインストールでエラーになってしまう。 下記を参考に一度 sqlite3 を削除して入れなおしたらうまくいきました。 Mac Ports で Apache2 のインストールエラー &#8211; Get crazy $ sudo port clean --all sqlite3 $ sudo port install sqlite3 設定ファイルのコピーと文法チェック $ sudo cp /opt/local/apache2/conf/httpd.conf.sample /opt/local/apache2/conf/httpd.conf $ /opt/local/apache2/bin/apachectl -t 起動と停止 手動での起動 $ sudo /opt/local/apache2/bin/apachectl start 試しに [...]]]></description>
			<content:encoded><![CDATA[<p>Apache + MySQL + PHP を MacPorts で入れてみました。</p>
<h4>Apache のインストール</h4>
<pre class="shell">$ sudo port install apache2</pre>
<p>しかし、sqlite3 のインストールでエラーになってしまう。<br />
下記を参考に一度 sqlite3 を削除して入れなおしたらうまくいきました。<br />
<a href="http://d.hatena.ne.jp/mtbtaizo/20080612" target="_blank" class="liexternal">Mac Ports で Apache2 のインストールエラー &#8211; Get crazy</a></p>
<pre class="shell">$ sudo port clean --all sqlite3</pre>
<pre class="shell">$ sudo port install sqlite3</pre>
<p><span id="more-554"></span></p>
<h5>設定ファイルのコピーと文法チェック</h5>
<pre class="shell">
$ sudo cp /opt/local/apache2/conf/httpd.conf.sample /opt/local/apache2/conf/httpd.conf
$ /opt/local/apache2/bin/apachectl -t
</pre>
<h5>起動と停止</h5>
<p>手動での起動</p>
<pre class="shell">$ sudo /opt/local/apache2/bin/apachectl start</pre>
<p>試しに http://localhost/ にブラウザでアクセスしてみる<br />
<a href="http://www.syuhari.jp/blog/wp-content/uploads/2008/07/apache_start.png" class="liimagelink"><img src="http://www.syuhari.jp/blog/wp-content/uploads/2008/07/apache_start-300x161.png" alt="" title="apache_start" width="300" height="161" class="alignnone size-medium wp-image-556 screenshot" /></a></p>
<p>手動での停止</p>
<pre class="shell">$ sudo /opt/local/apache2/bin/apachectl stop </pre>
<p>自動起動の設定</p>
<pre class="shell">$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist </pre>
<p>apachectl のエイリアスを設定</p>
<pre class="shell">$ vi /~.profile
alias apache2ctl='sudo /opt/local/apache2/bin/apachectl' 

$ source /~.profile
</pre>
<h4>MySQL のインストール</h4>
<pre class="shell">$ sudo port install mysql5 +server</pre>
<p>my.cnfをコピー</p>
<pre class="shell">$ sudo cp /opt/local/share/mysql5/mysql/my-medium.cnf /etc/my.cnf</pre>
<p>データベースの初期化</p>
<pre class="shell">$ sudo -u mysql mysql_install_db5</pre>
<p>自動起動の設定</p>
<pre class="shell">$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist</pre>
<p>手動での起動と停止</p>
<pre class="shell">$ sudo mysqld_safe5 &#038;
$ mysqladmin5 -u root -p shutdown</pre>
<p>root のパスワードを設定</p>
<pre class="shell">$ mysqladmin5 -u root password [yourpassword]</pre>
<p>root での接続テスト</p>
<pre class="shell">$ mysql5 -u root -p </pre>
<h4>PHP のインストール</h4>
<pre class="shell">$ sudo port install php5 +apache2 +mysql5 +pear</pre>
<p>エラーになったので、一度 PHP5 を削除してから再度インストール。GD や curl などもあとで必要になるので variants を変えてみた。</p>
<pre class="shell">$ sudo port clean -all php5
$ sudo port install php5 +apache2 +curl +gd +mysql5 +imap +pear</pre>
</pre>
<p>今度はうまくいきました。</p>
<h5>httpd.conf にLoadModuleを追加する</h5>
<pre class="shell">$ cd /opt/local/apache2/modules
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so</pre>
<p>これで /opt/local/apache2/conf/httpd.conf にLoadModule行が追加されます。</p>
<h5>php.iniの配置</h5>
<pre class="shell">$ sudo cp /opt/local/etc/php.ini-dist /opt/local/etc/php.ini</pre>
<p>設定の変更などは使いながらやっていこうと思います。</p>
<h5>httpd.conf に PHP の設定をする</h5>
<p>httpd.conf に下記を追加</p>
<pre class="shell">Include conf/extras-conf/mod_php.conf </pre>
<h5>PHP の確認</h5>
<p>Apache を再起動して、ドキュメントルート(/opt/local/apache2/htdocs)に phpinfo() を実行するファイルを作成してブラウザで表示できるか確認。</p>
<p>参考サイト<br />
<a href="http://blog.lab4frog.com/blog/2007/11/leopardmacports_041d.html" target="_blank" class="liexternal">ふるかわごうのブログ: LeopardでMacPorts（１）MySQL</a><br />
<a href="http://blog.lab4frog.com/blog/2007/11/leopardmacports_4053.html" target="_blank" class="liexternal">ふるかわごうのブログ: LeopardでMacPorts（２）Apache2</a><br />
<a href="http://blog.lab4frog.com/blog/2007/11/leopardmacports_b3e0.html" target="_blank" class="liexternal">ふるかわごうのブログ: LeopardでMacPorts（３）PHP5</a><br />
<a href="http://colamune.com/blog/archives/38" target="_blank" class="liexternal">COLAMUNE ≫ Blog Archive ≫ MacPortsだけでPHP5+GD2を構築(Leopard)</a></p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.syuhari.jp%2Farchives%2F554&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://blog.syuhari.jp/archives/554/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>シンボリックリンクのファイルを Apache で表示できなかったメモ</title>
		<link>http://blog.syuhari.jp/archives/480</link>
		<comments>http://blog.syuhari.jp/archives/480#comments</comments>
		<pubDate>Tue, 08 Jul 2008 06:53:13 +0000</pubDate>
		<dc:creator>matsuura</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[403]]></category>
		<category><![CDATA[conf]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[option]]></category>
		<category><![CDATA[symbolic]]></category>
		<category><![CDATA[yml]]></category>

		<guid isPermaLink="false">http://www.syuhari.jp/blog/?p=480</guid>
		<description><![CDATA[ちょっと恥ずかしい失敗なのですが、解決までに少し時間を取られたので反省を込めてメモ。 状況 Apaceh のドキュメントルート以外のファイルを表示するためにシンボリックリンクを作成 そのファイルを表示させようとしたところ「403 Forbidden」になる エラーログには Symbolic link not allowed or link target not accessible 確認点 Apache の実行ユーザでシンボリックリンク先のファイルに実行権限がないのかと思い確認 httpd.conf を確認 OptionsにFollowSymLinks が指定してあるか確認 しかし、上記2点とも問題なし 結局 シンボリックリンクが /var/www/html/hoge => /home/foo/hoge だったのだが、 /home/foo のパーミッションの問題でした。]]></description>
			<content:encoded><![CDATA[<p>ちょっと恥ずかしい失敗なのですが、解決までに少し時間を取られたので反省を込めてメモ。</p>
<h4>状況</h4>
<ul>
<li>Apaceh のドキュメントルート以外のファイルを表示するためにシンボリックリンクを作成</li>
<li>そのファイルを表示させようとしたところ「403 Forbidden」になる</li>
<li>エラーログには Symbolic link not allowed or link target not accessible</li>
</ul>
<p><span id="more-480"></span></p>
<h4>確認点</h4>
<ul>
<li>Apache の実行ユーザでシンボリックリンク先のファイルに実行権限がないのかと思い確認</li>
<li>httpd.conf を確認 OptionsにFollowSymLinks が指定してあるか確認</li>
</ul>
<p>しかし、上記2点とも問題なし</p>
<h4>結局</h4>
<p>シンボリックリンクが /var/www/html/hoge => /home/foo/hoge だったのだが、<br />
/home/foo のパーミッションの問題でした。</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.syuhari.jp%2Farchives%2F480&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://blog.syuhari.jp/archives/480/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

