php - How do I configure nginx rewrite rules to get CakePHP working on CentOS? -


Hello, help me out, I'm trying to setup a CakePap environment when running a NGX on a Seacon Server, which is actually with CGI. I have a WordPress site on the server and a phpmyadmin site, so I have correctly configured PHP

My problem is that I can not get the rule right in my vhost again So that the cake renders the pages correctly, i.e. with style and so on. I swallowed as much as possible and the main consensus from the same sites given below is that I

  place / {root / var / www /sites/somedomain.com/current; Index index.php index.html; # If the file exists as a static file, then provide it service without having to rewrite all # directly if (-f $ request_filename) {break; } If (! -f $ request_filename) {rewrite ^ / (. +) $ / Endex.php? Url = $ 1 last; break; The problem is that you write again that you run cakes directly from Webroot, which is not what I have to do. I have a standard setup for each site. I. A folder per site that contains the following folders include logs, backups, private and public. I is being publiced ​​where nginx is looking to serve its files, but I have private / cake / personal / cake /  < P>  

To add back the cake is installed in private with a symlink

  server {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 the cake application to run in #sub-directory #Cake installation is not in the root, but elsewhere APP / WebTot / index.fipIP ** location / home / public / html / apdomain / private / cake {index index .php; If (! -e $ request_filename) {rewrite ^ / (. +) $ /home/public_html/app.domain.com/private/cake/$1 final; break; }} Places / Home / Public_Hatin / AP Domain / Private / Cake / {Index Index. PHP; If (! -e $ request_filename) {rewrite ^ / (. +) $ /home/public_html/app.domain.com/public/index.php?url=$1 last; break; }} Pass PHP scripts to listen to the FastCGI server at # 127.0.0.1:9000 ~ \ .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; }}  

Now I said that I can see the main index of cake. PPP and it is linked to my DB, but before I would like to proceed, without this page Style is to configure it correctly What am I doing?

Thanks Senil

At a glance, your problem may be that you Deploying the original cake folder are not indicating nginx in the webroot of the app is not really the way to go under any web server.

The following is a full server-block that I'm running cake apps. In fact, I only have the first four rows and then separate the rest of the file from "cakephp.exe".

"fastcgi_param SERVER_NAME $ host;" A note on This is because some of my apps use $ _SERVER ['SERVER_NAME'], and that does not mean the same meaning in nginx as Apache. If there are many server_names (defined) nginx in your server, then always the first one will pass from php.

  server {server_name cakeapp.example.com; Root / var / www / vhosts / cake / app / webroot; Access_log /var/log/nginx/cakeapp.access.log; Error_log /var/log/nginx/cakeapp.error.log; Listen to 80; Rewrite_log turned on; # Rewrite rule for #cappop location / {index index.php index.html; # If the file exists as a static file, then provide it # at all without running all the revival tests at # if (-f $ request_filename) {break; } If (! -f $ request_filename) {rewrite ^ / (. +) $ / Endex.php? Url = $ 1 last; break; }} Place ~ * \ favicon.ico $ {6m; } Place ~ ^ / img / {7d; } Place ~ \ .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; Fastcgi_param SERVER_NAME $ host; } Place ~ /\.ht {reject all; }}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -