phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.96k forks source link

phalcon does not support using nginx $_SERVER[‘REQUEST_URI’] as source of URIs: #11250

Closed overlords closed 8 years ago

overlords commented 8 years ago

environment

not support

server {
    listen 80;

    server_name localhost.dev;

    index index.php index.html index.htm;

    root /usr/local/nginx/html/one/public;

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

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
    }

    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root /usr/local/nginx/html/one/public;
    }

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

support

server {
    listen      80;

    server_name one.app;

    root        /usr/local/nginx/html/one/public;

    #access_log  /var/log/nginx/$host-access.log;
    #error_log   /var/log/nginx/$host-error.log error;

    index index.php index.html index.htm;

    root        /usr/local/nginx/html/one/public;

    #access_log  /var/log/nginx/$host-access.log;
    #error_log   /var/log/nginx/$host-error.log error;

    index index.php index.html index.htm;

    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^(.*)$ /index.php?_url=$1;
    }

    location ~ \.php {
        # try_files    $uri =404;

        fastcgi_index  /index.php;
        fastcgi_pass   127.0.0.1:9000;

        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;
    }

    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root /usr/local/nginx/html/one/public;
    }

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

https://docs.phalconphp.com/en/latest/reference/nginx.html

If Phancon2 does not support should be deleted in the document

phalcon commented 8 years ago

It`s supported: https://docs.phalconphp.com/en/latest/reference/routing.html#uri-sources

overlords commented 8 years ago

@phalcon :thumbsup:

michealzh commented 7 years ago

I have the same problem,nginx 1.10, phalcon 3.1.0,in Macos,with same nginx config ,but the router is not work for me.

sergeyklay commented 7 years ago

@michealzh Open please new issue with small code to reproduce

s1rc0 commented 7 years ago

@michealzh @sergeyklay did you fix this problem? I still cant configure nginx + php-fpm.

nginx conf:

server {
    listen      80;
    server_name server;
    root        /home/apps/www/server/site/public;
    index       index.php index.html index.htm;
    charset     utf-8;
    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^(.*)$ /index.php?command=$1;
    }

    location ~ \.php {
        fastcgi_pass  unix:/var/php5-fpm.sock;
        fastcgi_index index.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;
    }

    location ~ /\.ht {
        deny all;
    }
}
sergeyklay commented 7 years ago

@s1rc0 Open please new issue with small code (and steps) to reproduce