気付いている人もいると思いますが、当サイトを SSL 対応としました。http でも https でもどちらでも同じページが表示されます。
曲がりなりにもログイン機能を有しているので、このご時世 SSL 対応にしないとと思い立ち、無料で証明書を発行してくれる(個人限定で1年間) StartSSL を知ったので、設定してみました。
を参考にサーバーの Apache を設定、StartSSL の場合、中間認証局の証明書 sub.ca.crt も必須なので忘れずに設定する。
sub.ca.crt は DER 形式(バイナリファイル)なので、次のように PEM 形式に変換する
mv sub.class1.server.ca.crt sub.ca.der openssl x509 -inform der -in sub.ca.der -out sub.ca.crt
なお、Apache 1.3 での SSL は ひとつのIPでひとつのホストしか利用できないので、ネームベースのバーチャルホストではどれかひとつのホストに絞る必要があるので、xoops.hypweb.net 以外のホストは、http にリダイレクトさせています。(そもそも、接続前に証明書が不正だと警告が出るけどね)
サイト内リンクをきちんと区分けするため、http と https で、Smarty テンプレート利用時のコンテンツキャッシュを別にする。
class/template.php の XoopsTpl クラスに次のメソッドを追加し Smarty クラスのメソッドをオーバーライドする。
これは、XOOPS 2.0.16a の場合だけど、XCL ではプリロードでいけるのかな。 :thinking:
function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
{
if (XOOPS_IS_SSL) {
$cache_id .= '_SSL';
}
return parent::clear_cache($tpl_file, $cache_id, $compile_id, $exp_time);
}
function is_cached($tpl_file, $cache_id = null, $compile_id = null)
{
if (XOOPS_IS_SSL) {
$cache_id .= '_SSL';
}
return parent::is_cached($tpl_file, $cache_id, $compile_id);
}
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
{
if (XOOPS_IS_SSL) {
$cache_id .= '_SSL';
}
return parent::fetch($resource_name, $cache_id, $compile_id, $display);
}
Page Info | |
---|---|
Page Name : | nao-pon/blog/2010-03-27 |
Page aliases : | None |
Page owner : | nao-pon |
Can Read | |
Groups : | All visitors |
Users : | All visitors |
Can Edit | |
Groups : | No one |
Users : | ゲスト |