CakePhp & amp; Подстраницы Nginx не отображаются

Недавно я размещал приложение cakephp на nginx через порт 8085.

Я перезагружаю nginx и страница индекса загружается правильно.
Но всякий раз, когда я нажимаю на ссылку того же сайта (другую страницу), в Интернете ничего не печатается.

Пожалуйста, подскажите, что не так в моей настройке nginx.

Вот мой конф nginx.

server {
server_name  example.com;
root   /var/www/html/cakephp/app/webroot;
access_log  /var/log/nginx/cakeapp.access.log;
error_log   /var/log/nginx/cakeapp.error.log;

listen       8085;
rewrite_log on;

# rewrite rules for cakephp
location / {
index  index.php index.html;

# If the file exists as a static file serve it
# directly without running all
# the other rewite tests on it
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}

location ~* \favicon.ico$ {
expires 6m;
}
location ~ ^/img/ {
expires 7d;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi.conf;
fastcgi_param SERVER_NAME $host;
}

location ~ /\.ht {
deny  all;
}
}

0

Решение

Это немного отличается от торт PHP, попробуйте это вместо

root DIR/app/webroot/;
location / {
index index.php index.html;
rewrite ^/$ /index.php?url=/;
if (!-e $request_filename) {
rewrite ^(/.*)$ /index.php?url=$1 last;
}
}

Я не пробую этот кусок кода, но вы можете.

0

Другие решения

Других решений пока нет …