Nginx

Hello, I got problem.

I have developed Yii2 project under share host as described here https://github.com/yiisoft/yii2-app-adv … hosting.md.

Create nginx config as described here https://github.com/mickgeek/yii2-advanced-one-domain-config/blob/master/vhosts/nginx.conf

Front and backoffice working, but in dashboard don’t work some functions.

If I wrote this url - http://site.com/admin/backoffice/backend-partners, it works.

If I wrote this with params - http://site.com/admin/backoffice/backend-partners/structure?id=8699, it doesn’t work Bad Request (#400). id is absent.

Thi sis config




server

{

    listen   80;


    root /var/www/site;

    index index.php index.html index.htm;

    charset      utf-8;

    client_max_body_size  100M;

    client_header_buffer_size 4k;

    large_client_header_buffers 8 16k;


    access_log /var/log/nginx/access.log;

    error_log /var/log/nginx/error.log;

    

    server_name site.com;


    location /

    {

        try_files $uri $uri/ /index.php?$args;

    }


    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;

    

    location = /50x.html

    {

        root /var/www/;

    }

    

    # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock

    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 ~* \.(htaccess|htpasswd|svn|git) 

    {

        deny all;

    }


    location /admin {

        alias  /var/www/site/admin;

        try_files  $uri /admin/index.php;

    }


    location ~* ^/admin/(.+\.php)$ 

    {

        try_files  $uri /admin/$1?$args;

    }

}



a example of my nginx config:


    location ~ \.php$ {

        include         conf.d/php-fpm;


        # Fix for server variables that behave differently under nginx/php-fpm tha

        fastcgi_split_path_info ^(.+\.php)(/.+)$;


        # Include the standard fastcgi_params file included with nginx

        include fastcgi_params;

        fastcgi_param  PATH_INFO        $fastcgi_path_info;

        fastcgi_index index.php;


        # Override the SCRIPT_FILENAME variable set by fastcgi_params

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        # Pass to upstream PHP-FPM; This must match whatever you name your upstrea

    }



and php-fpm configuration:


fastcgi_pass                    unix:/var/run/php-fpm.socket;

#fastcgi_pass                   127.0.0.1:9000;

fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script_name;

try_files                       $uri = 404;

fastcgi_split_path_info         ^(.+\.php)(.*)$;

#fastcgi_index                  index.php;

fastcgi_intercept_errors        on;

fastcgi_ignore_client_abort     off;

fastcgi_connect_timeout         60;

fastcgi_send_timeout            180;

fastcgi_read_timeout            180;

fastcgi_buffer_size             128k;

fastcgi_buffers                 4 256k;

fastcgi_busy_buffers_size       256k;

fastcgi_temp_file_write_size    256k;

fastcgi_param GEOIP_COUNTRY_CODE        $geoip_country_code;

fastcgi_param GEOIP_COUNTRY_NAME        $geoip_country_name;

include fastcgi_params;



If it doesn’t work for you it seams that there are some misconfigurations in UrlManager, try to comment them all and check if site works without fancy url