We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Raspberry Pi with Debian Wheezy and Nginx problem

First of all I would like to congratulate you for this fine module. I am eager to start playing around with it so I decided to put it in use on a Raspberry Pi with Debian wheezy.

Please check the nginx configuration here: https://rpi.eletter.gr I have nginx 1.2.1 installed and Phalcon 1.2.0 BETA 2 as you can see here : https://rpi.eletter.gr/check.php

I have git cloned the very first basic test example from https://github.com/phalcon/tutorial which I have cloned it under /usr/share/nginx/www/test01.

When I access the tutorial like https://rpi.eletter.gr/test01/ I get a 403. When I access the tutorial like https://rpi.eletter.gr/test01/public/ it runs. What I want to achieve is to call the example tutorial like this, https://rpi.eletter.gr/test01

Currently I have this on my /etc/nginx/sites-enabled/default

server { listen 80;

    root /usr/share/nginx/www;
    index index.php index.html index.htm;

    server_name localhost rpi.eletter.com;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.php;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

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

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

    }

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

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

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }

    location ~ /\.ht {
            deny all;
    }

}



404

You need to change root path.

root /usr/share/nginx/www/public;

I believe you meant root /usr/share/nginx/www/test01/public; If I do this, change the root path like root /usr/share/nginx/www/test01/public; I will be missing the option to have many different subfolders with different applications. This is not a viable option in this case. Thanks for the response though.



404

Sorry, i missed your "location /test01/" block. My mistake.



404

Ok. The problem is with try_files. https://wiki.nginx.org/HttpCoreModule#try_files

nginx redirects to "/test01/public/index.php;" and starts check of new address. Stops at "location /test01/", redirect and so on = infinity loop.

Try to put location "location ~ .php$" on top of other "location" blocks.

Nope! It didn't do the trick!