Skip to content

Instantly share code, notes, and snippets.

@pasela
Created July 5, 2012 09:37
Show Gist options
  • Save pasela/3052624 to your computer and use it in GitHub Desktop.
Save pasela/3052624 to your computer and use it in GitHub Desktop.
nginx configuration example for CakePHP 2.x
#
# nginx configuration example for CakePHP 2.x
#
server {
listen 80;
server_name cakephp2.example;
root /var/www/cakephp2/app/webroot;
access_log /var/log/nginx/cakephp2.access.log;
error_log /var/log/nginx/cakephp2.error.log;
location / {
index index.php;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
location ~ \.php/ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
}
#error_page 404 /404.html;
#location = /404.html {
# root /usr/share/nginx/html;
#}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /(\.ht|\.user.ini|\.git|\.hg|\.bzr|\.svn) {
deny all;
}
}
@samuelrs
Copy link

good afternoon passela,
I am trying to configure cakephp with nginx in ubuntu, even on my local machine (localhost). And I'm not getting.
Could you give me any tips of how to configure?

Thank you

@samuelrs
Copy link

I have a more detailed question in the forum nginx:

http://forum.nginx.org/read.php?11,241413

If you can take a look. Or if you prefer I can pass my email so we can exchange information.
thank you

@rubo77
Copy link

rubo77 commented Nov 11, 2015

So did you manage to run it? That forum has registered users only access.

can you post the result here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment