Yii + Nginx + urlManager

Hi. My Yii webapp is placed into a subdirectory, and I’m getting MAD to get it running.

I mean, it works fine without urlManager, but when I try to enable it I found no way to make it work!

My actualy nginx config is this one:




server {

    listen 443 default_server ssl;

    server_name wifinext wifinext.mydomain.com;

    rewrite ^/$ /mgmt/ permanent;

    server_tokens off;


    ssl_certificate /dati/com.crt;

    ssl_certificate_key /dati/com.key;

    ssl_client_certificate /dati/gd_bundle.crt;

    

    ssl_session_timeout 5m;

    keepalive_timeout    70;


    ssl_protocols SSLv3 TLSv1;

    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;

    ssl_prefer_server_ciphers on;

    root /dati/mydomain/www/management_site;


    location / {

        # First attempt to serve request as file, then

        # as directory, then fall back to index.html

        try_files $uri $uri/ /index.html;

        index index.php index.html;

        root /dati/mydomain/www/management_site;

    }


    ## Images and static content is treated different

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {

        access_log        off;

        expires           30d;

        root /dati/mydomain/www/management_site;

    }


    ## Parse all .php file in the /var/www directory

    location ~ .php$ {

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

        fastcgi_pass   backend;

        fastcgi_param HTTPS on;

        include /etc/nginx/fastcgi_params;

        include /etc/nginx/fastcgi_params_yetopen;

    }   


    location ~ /\.ht {

        deny all;

    }


    location /phpmyadmin {

        root /usr/share/;

        index index.php index.html index.htm;

        location ~ ^/phpmyadmin/(.+\.php)$ {

            try_files $uri =404;

            root /usr/share/;

            fastcgi_pass backend;

            include /etc/nginx/fastcgi_params;

            include /etc/nginx/fastcgi_params_yetopen;

            fastcgi_param HTTPS on;

        }

        location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {

            root /usr/share/;

        }

    }


}



I tried modifying the configuration according to this post

but no way, when I enable urlManager I get 404 file not fuond!

Any idea?

thanks

Hi Maxxer,

try this :







	location /your_sub_dir {

		try_files $uri $uri/ /your_sub_dir/index.php?$query_string;

	}


	location ~ \.php$ {

		try_files $uri =404;

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

		fastcgi_pass   127.0.0.1:9000;

		fastcgi_index  index.php;

		include /etc/nginx/fastcgi_params;

		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

	}




gilles.

The exact solution needed to fix a long hour of issue … the following is the key for us:


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

Many thanks and cheers!