fastcgi, try_files, problems
Tomasz Pajor
nikon at puffy.pl
Fri Jul 17 13:35:38 MSD 2009
Maxim Dounin wrote:
>> There is no /administrator/index.php file.
>> I want to simply separate the administrator backend, and serve it from
>> the same machine as balancer, because i've got all the gallery photos on
>> this machine.
>>
>
> So there is no /disk0/vhosts/domain/public/administrator directory
> at all, am I right?
>
No there isn't.
>
>> I'm migrating this from apache.
>>
>> .htaccess says:
>> RewriteEngine On
>> RewriteCond %{REQUEST_FILENAME} -s [OR]
>> RewriteCond %{REQUEST_FILENAME} -l [OR]
>> RewriteCond %{REQUEST_FILENAME} -d
>> RewriteRule ^.*$ - [NC,L]
>> RewriteRule ^.*$ index.php [NC,L]
>>
>
> As far as I understand you basically need to pass everything to
> fastcgi while rewriting everything that doesn't exist to
> index.php? Try something like this:
>
> root /disk0/vhosts/domain/public;
>
> fastcgi_index index.php;
>
> location / {
> try_files $uri $uri/ @fallback;
> fastcgi_pass apps;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> ...
> }
>
> location @fallback {
> fastcgi_pass apps;
> fastcgi_param SCRIPT_FILENAME $document_root/index.php;
> ...
> }
>
> location /administrator/ {
> rewrite ^/administrator(.*) $1 break;
> try_files $uri $uri/ @adminfallback;
> fastcgi_pass 127.0.0.1:3000;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> ...
> }
>
> location @adminfallback {
> fastcgi_pass 127.0.0.1:3000;
> fastcgi_param SCRIPT_FILENAME $document_root/index.php;
> ...
> }
>
>
It works flawlessly thank You Maxim!
More information about the nginx
mailing list