My bad, I had a copy/paste malfunction :)
Here is a basic set-up:
server{
listen 80;
server_name my_broken_project;
rewrite_log on;
root /var/www/my_broken_project/webroot;
index index.php;
error_log /var/www/my_broken_project/tmp/logs/error.log;
access_log /var/www/my_broken_project/tmp/logs/access.log;
location / {
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}
location ~ \.php$ {
fastcgi_pass unix:/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
}
HTH
On Sunday, October 26, 2014 3:09:07 AM UTC-4, CrotchFrog wrote:
>
> When you say "i have a redirection to my default login action
> *my_ip/my_cakephp_project/login* with an* 404 error*" ... my first
> impression would be that your app is working but you are being denied
> (redirected) by the auth component. Looking at your config I don't think
> this is the case and only lends to the confusion. My advice would be to
> start over with your server config but this time keep it to it's most basic
> form. Don't start out with such a convoluted config. Your goal here is to
> get your site working ... once it works at least you'll know the set-up is
> good. You can mess with it and break things later :)
>
>
> 1. In your server block the *server_name *directive lets you provide
> name-based virtual hosting, thus allowing multiple domains to be served
> from a single IP address which I believe is what you are trying to
> achieve.
> With this being the case let's skip putting your server ip someplace
> clearly marked as *server_name*. Pick a name ... any *name* will do.
> For simplicity sake and to avoid confusion let's call it
> *my_broken_project*.
> 2. Create one config file for each project you want to host. We'll
> make a simple config file for you to copy but keep in mind that each file
> should contain it's own server block where *server_name *specifies
> which domain this file affects. I usually name my domain configs the same
> as my *server_name *so for this example I would save the file as
> *my_broken_project
> *and create a symlink to that file in /etc/nginx/sites-enabled.
> 3. We'll use a basic config to get things working. Copy it and save it
> as */etc/nginx/sites-available/cake_default*. You can use this file
> each time you create a new Cake project. cd into that directory and *cp
> cake_default my_broken_project*. Remember to symlink to this file in
> */etc/nginx/sites-enabled*.
> 4. On your *local machine* (not your server) open */etc/hosts* and add
> a single line at the bottom of the file containing your server ip address
> and the *server name* you chose. As an example: *192.168.1.123
> my_broken_project*. Now when you view your project using your browser
> you will visit *http://my_broken_project <http://my_broken_project>
> *instead
> of http://192.168.1.123/my_broken_project.
>
> Here is the config we will use to get you started:
>
> Enter code here...server{
> listen 80;
> server_name irs;
> rewrite_log on;
> root /var/www/irs/webroot;
> index index.php;
>
> error_log /var/www/irs/logs/error.log;
> #access_log /var/www/nk/log/access.log;
>
> # Not found this on disk?
> # Feed to CakePHP for further processing!
> location / {
> 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:/run/php5-fpm.sock;
> #fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_intercept_errors on;
> fastcgi_param SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
> include fastcgi_params;
> }
>
>
>
>
>
> On Saturday, October 25, 2014 7:20:51 PM UTC-4, Saif Turki wrote:
>>
>> i have installed nginx + php-fpm, test it with phpinfo() file and
>> phpmyadmin(downloaded from the phpmyadmin.net website) -> it works
>> correctly and i can access to it by just entering on the browser
>> *my_ip/phpmyadmin*
>> when i want to access to one of my cakephp project , i have a redirection
>> to my default login action *my_ip/my_cakephp_project/login* with an* 404
>> error*
>> the log doesn't contain any error
>> that's the config that i have used :
>>
>> 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;
>> }
>> }
>>
>>
>> thanks
>> ------------------------------
>> View this message in context: Re: using cakephp with nginx
>> <http://cakephp.1045679.n5.nabble.com/using-cakephp-with-nginx-tp5719912p5719957.html>
>> Sent from the CakePHP mailing list archive
>> <http://cakephp.1045679.n5.nabble.com/> at Nabble.com.
>>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.