SORICH SAMURAIby SORICH

hello,world

2010年6月
             
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

最新の記事

カテゴリー

月間アーカイブ

最新のトラックバック

最新のトラックバック

ubuntu    2010.02.02 [ Tue ] 18:20

[ubuntu][apache][php][oracle]サーバー構築のメモ で用意したサーバーで、CakePHPのアプリケーションを動くようにします。


■Apacheの設定
・mod_rewriteを有効にする
root@ubuntu:~# a2enmod rewrite
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!

・ドキュメントルートの設定
ドキュメントルートの設定は、/etc/apache2/sites-available/default に書いてあります。
CakePHPを動かすためには、Options と AllowOverride に最低限、次の権限を設定する必要があります。
...
<Directory /var/www/>
        Options FollowSymLinks
        AllowOverride FileInfo
        Order allow,deny
        allow from all
</Directory>
...
※Options は mod_rewrite、AllowOverride は .htaccessのための設定です。

参考
Apache コア機能
http://httpd.apache.org/docs/2.2/ja/mod/core.html#options
http://httpd.apache.org/docs/2.2/ja/mod/core.html#allowoverride

すでに他のアプリケーションを動かしている場合は、例えば /etc/apache2/sites-available/new など別ファイルに仮想ホスト設定を記述して有効にすることもできます。

newの設定を有効にする場合
root@ubuntu:~# a2ensite new
Enabling site new.
Run '/etc/init.d/apache2 reload' to activate new configuration!
defaultの設定を無効にする場合
root@ubuntu:~# a2dissite default
Site default disabled.
Run '/etc/init.d/apache2 reload' to activate new configuration!
この方法で設定ファイルを小分けにしておけば、特定のアプリケーションのみ設定を無効にしたい場合など、該当の行をコメントアウトするのではなく、コマンドでファイル単位で簡単に切り替えられるので楽ですね。

設定を変更したら、Apacheの再起動は忘れずに。
root@ubuntu:~# service apache2 restart

・SSLの設定
こちらは必要であれば。
root@ubuntu:~# a2enmod ssl
Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
Run '/etc/init.d/apache2 restart' to activate new configuration

証明書と秘密鍵の発行などはこちらに
UbuntuでApache2+SSLしてみる - toguniの日記

次のようなエラーがでる場合は、Listen 443が複数定義されている可能性があります。
root@ubuntu:~# service apache2 restart
 * Restarting web server apache2
 ... waiting (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs
Listen 443は、/etc/apache2/ports.conf にすでに記述されているので、/etc/apache2/sites-available/httpd-ssl.conf のものは忘れずにコメントアウトしておきましょう。

■デプロイ
・CakePHPのアプリケーションをドキュメントルートにアップロード
・app/tmp に Apacheの実行ユーザーが書き込める権限を与える

トラックバック(0) コメント(2)

カテゴリ:

コメント(2)

ありがとう :

起動できずにはまってました。おかげでなおりました。
ありがとうございます。ほんとうに本当に助かりました!!!

>Listen 443は、/etc/apache2/ports.conf にすでに記述されているので、/etc/apache2/sites-available/httpd-ssl.conf のものは忘れずにコメントアウトしておきましょう。

しまむら :

お役に立てたようで、なによりですー。

コメントする




トラックバック(0)

このブログ記事を参照しているブログ一覧: [ubuntu][apache][cakephp]サーバー構築のメモ(2)


このブログ記事に対するトラックバックURL:

Copyright(C) SORICH Ltd. All Rights Reserved.