Welcome! Log In Create A New Profile

Advanced

nginx configuration with cakephp 2

Posted by flashios09 
nginx configuration with cakephp 2
October 13, 2014 01:36PM
sorry for my bad english :(

i installed nginx on debian 7 wheezy to replace apache

i used the cakephp framework v2 and when i want to access to one of my project on the server it doesn't work :(

i searched on the internet and it seems like nginx doesn't work with .htaccess file that needs cakephp to rewrite URLs

i tried many configurations but i have always a 404 error when i enter in the url my_ip/my_project after redirecting to the default login action my_ip/my_project/login

that's my config

server {
listen 80;

root /home/sites/;
index index.php index.html index.htm;

server_name my_server_ip;

location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}

location / {
try_files $uri $uri/ /index.php;
}

error_page 404 /404.html;

location = /50x.html {
root /usr/share/nginx/www;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

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

server {
listen 80;
server_name my_server_ip;
root /home/sites/my_project/app/webroot;

access_log /var/log/nginx/my_project.access.log;
error_log /var/log/nginx/my_project.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 unix:/var/run/php5-fpm.sock;
}

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 unix:/var/run/php5-fpm.sock;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
log_not_found off;
access_log off;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ /(\.ht|\.user.ini|\.git|\.hg|\.bzr|\.svn) {
deny all;
}
}

what i have to do ? i didn't identify the problem :(

thanks :)



Edited 1 time(s). Last edit at 10/13/2014 01:36PM by flashios09.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 132
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready