Friday, May 3, 2013

RE: CakePHP with Nginx

Check the root: /webroot

 

server {

    listen      80;

    server_name example.com www.example.com;

    access_log  /var/log/nginx/example.com.access.log;

    error_log   /var/log/nginx/example.com.error.log;

    rewrite_log on;

    root        /var/www/example.com/app/webroot;

    index       index.php index.html index.htm;

 

    # Not found this on disk?

    # Feed to CakePHP for further processing!

    if (!-e $request_filename) {

        rewrite ^/(.+)$ /index.php?url=$1 last;

        break;

    }

 

    # Pass the PHP scripts to FastCGI server

    # listening on 127.0.0.1:9000

    location ~ \.php$ {

        # fastcgi_pass   unix:/tmp/php-fastcgi.sock;

        fastcgi_pass   127.0.0.1:9000;

        fastcgi_index  index.php;

        fastcgi_intercept_errors on; # to support 404s for PHP files not found

        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

        include        fastcgi_params;

    }

 

    # Static files.

   # Set expire headers, Turn off access log

    location ~* \favicon.ico$ {

        access_log off;

        expires 1d;

        add_header Cache-Control public;

    }

    location ~ ^/(img|cjs|ccss)/ {

        access_log off;

        expires 7d;

        add_header Cache-Control public;

    }

 

    # Deny access to .htaccess files,

    # git & svn repositories, etc

    location ~ /(\.ht|\.git|\.svn) {

        deny  all;

    }

}

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Iuri Sampaio
Sent: Friday, May 03, 2013 9:03 PM
To: cake-php@googlegroups.com
Subject: CakePHP with Nginx

 

I'm trying to set up my cakePHP with nginx webserver/proxy but it hasn't worked out so far. The server config block is bellow. I am using proxy. As in: 

location / { 
  enter code here`proxy_pass "192.168.1.23"; 
  proxy_set_header host mywebsite.com; 
  root   /var/www/mywebsite; 
  autoindex off; 
  index  index.php index.html index.htm; 
  rewrite ^/$ /index.php?url=/; 
  if (!-e $request_filename) { 
    rewrite ^(/.*)$ /index.php?url=$1 last; 
  } 


Fastcgi params are: 


        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
        # 
        location ~ \.php.*$ { 
            fastcgi_pass   192.168.1.23:9000; 
            fastcgi_index  index.php; 
            fastcgi_param  SCRIPT_FILENAME  /var/www/mywebsite$fastcgi_script_name; 
            fastcgi_param  PATH_INFO $fastcgi_script_name; 

            include        /etc/nginx/fastcgi_params; 
        } 



With that I could get the closest to what it seems to be the answer, but not 100% yet. 

Now I get a message error that seems to be replicating index.php in the url 

#### 
The requested address '/index.php/index.php' was not found on this server. 


Please, Check that out http://natopique.com/members

Does anyone have an idea what could be wrong?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to
cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: