こんにちは誰かが私を助けてください、私はファクトCGIでNginxを実行しているCentosサーバー上にcakephp環境をセットアップしようとしています。サーバー上でWordPressサイトとphpmyadminサイトを既に実行しているので、PHPを正しく構成しています。
私の問題は、ケーキがページを正しくレンダリングするように、つまりスタイリングなどで、仮想ホストで書き換えルールを正しく設定できないことです。私は可能な限りグーグルで検索しましたが、以下のようなサイトからの主なコンセンサスは、次の書き換えルールを設定する必要があるということです。
location / {
root /var/www/sites/somedomain.com/current;
index index.php index.html;
# If the file exists as a static file serve it
# directly without running all
# the other rewrite tests on it
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}
http://blog.getintheloop.eu/2008/4/17/nginx-engine-x-rewrite-rules-for-cakephp
問題は、これらの書き直しは、私がやりたいことではないWebルートから直接ケーキを実行することを前提としていることです。各サイトの標準設定があります。つまり、サイトごとに1つのフォルダーがあり、ログ、バックアップ、プライベート、およびパブリックのフォルダーが含まれています。パブリックはnginxが提供するファイルを探している場所ですが、私はケーキをプライベートにインストールし、パブリックにシンボリックリンクを付けて/ private/cake/にリンクしています。
これは私の仮想ホストです
server {
listen 80;
server_name app.domain.com;
access_log /home/public_html/app.domain.com/log/access.log;
error_log /home/public_html/app.domain.com/log/error.log;
#configure Cake app to run in a sub-directory
#Cake install is not in root, but elsewhere and configured
#in APP/webroot/index.php**
location /home/public_html/app.domain.com/private/cake {
index index.php;
if (!-e $request_filename) {
rewrite ^/(.+)$ /home/public_html/app.domain.com/private/cake/$1 last;
break;
}
}
location /home/public_html/app.domain.com/private/cake/ {
index index.php;
if (!-e $request_filename) {
rewrite ^/(.+)$ /home/public_html/app.domain.com/public/index.php?url=$1 last;
break;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/public_html/app.domain.com/private/cake$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
私が言ったように、ケーキのメインのindex.phpを見て、それをDBに接続しましたが、このページにはスタイルがないので、先に進む前に、正しく構成したいと思います。私は何が間違っているのですか?
ありがとうseanl