2014年6月4日水曜日

nginx, hhvmでcakephpを動かす

cakephpをhhvm+nginx上で動かすように試みます。
(これまでの構築の続きなので前の記事の環境が前提となります。)

/usr/share/nginx/htmlにcakephpを配置します。

CakePHP-2.5.1を持ってきました。
/usr/share/nginx/html/cake_2_5
とします。

nginxの/etc/nginx/conf.d/default.confを編集します。

cakeのドキュメントルートは、app/webroot/になるので、以下のように変更します。

location / {
    root    /usr/share/nginx/html/cake_2_5/app/webroot;
    index  index.php index.html index.htm;
}

location ~ \.php$ {
    root           /usr/share/nginx/html/cake_2_5/app/webroot;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

今回、fastcgi_paramのところでは、$document_rootと変更しています。

これで、nginxのサービスを再起動しまして、
ホストPCからブラウザでアクセスします。
http://192.168.33.10/

CakePHPの既定のページが表示されるようになりました。

0 件のコメント:

コメントを投稿