Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've managed to solve this by adding App.base parameter to the cakephp configuration instead of using the App.baseUrl (looked the code in dispatcher.php).</p> <p>So let's say I have the cakephp copy located in /var/www/html/cakeprj and my WWWROOT is /var/www/html:</p> <ol> <li><p>nginx host configuration</p> <pre><code># that's for all other content on the web host location / { root /var/www/html; autoindex off; index index.php index.html index.htm; ... } # that's for cakephp location /cakeprj { rewrite ^/cakeprj$ /cakeprj/ permanent; rewrite ^/cakeprj/(.+)$ /$1 break; root /var/www/html/cakeprj/app/webroot; try_files $uri /$uri/ @cakephp; } # that's for all other php scripts on the web host location ~ \.php$ { root /var/www/html; fastcgi_pass unix:/var/lib/fcgi/php-fcgi.socket; ... include /etc/nginx/fastcgi_params; } # that's for cakephp execution location @cakephp { set $q $request_uri; if ($request_uri ~ "^/cakeprj(.+)$") { set $q $1; } fastcgi_param SCRIPT_FILENAME /var/www/html/cakeprj/app/webroot/index.php; fastcgi_param QUERY_STRING url=$q; fastcgi_pass unix:/var/lib/fcgi/php-fcgi.socket; include /etc/nginx/fastcgi_params; } </code></pre></li> <li><p>cakephp configuration in app/config/core.php</p> <pre><code>Configure::write('App.base', '/cakeprj'); Configure::write('App.baseUrl', '/cakeprj/'); // seems like it doesn't matter anymore </code></pre></li> </ol> <p>...and voila - you get nginx serving cakephp static files correctly, url passing to the cakephp dispatcher correctly and cakephp generating urls correctly as well.</p> <p>P.S. if your nginx doesn't support try_files I believe its configuration can be rewritten with if condition and another rewrite.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload