Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rewrite
On Mon, Sep 08, 2008 at 01:21:38PM +0300, Vasyl Kondrashov wrote:
> Пытаюсь перевести rewrite из:
> #________________________________________________________________________________________
> RewriteEngine on
> RewriteCond %{REQUEST_URI} ^/server-status$ [OR]
> RewriteCond %{REQUEST_URI} ^/server-info$ [OR]
> RewriteCond %{REQUEST_URI} ^/whm-server-status$
> RewriteRule (.*) - [L]
> RewriteRule ^$ index.php [L]
> RewriteRule ^sso_endpoint.php/ui$
> index.php/SSO/UI [L]
> RewriteRule ^sso_endpoint.php/SAML$
> index.php/SSO/Proxy [L]
> RewriteRule ^sso_endpoint.php/signout$
> index.php/SSO/Proxy [L]
> RewriteCond %{REQUEST_URI} ^/[a-z]+/.*$
> RewriteCond %{REQUEST_URI} [^/]$
> RewriteRule (.*) - [L]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule (.*) index.php/$1 [QSA,L]
>
> #__________________________________________________________________________________________
> в понятную nginx форму. Последний вариант:
>
> #__________________________________________________________________________________________
>
> if ($request_uri ~ ^/server-status$) {
> break;
> }
> if ($request_uri ~ ^/server-info$) {
> break;
> }
> if ($request_uri ~ ^/whm-server-status$) {
> break;
> }
> rewrite ^$ index.php last;
> rewrite ^sso_endpoint.php/ui$ index.php/SSO/UI last;
> rewrite ^sso_endpoint.php/SAML$ index.php/SSO/Proxy last;
> if ($request_uri ~ ^/[a-z]+/.*$) {
> break;
> }
> if ($request_uri ~ [^/]$) {
> break;
> }
> if (!-e $request_filename) {
> rewrite ^/(.*)$ /index.php/$1
> break;
> }
>
> #__________________________________________________________________________________________
>
> Перевод не дословный, но не это важно. При попытке открыть адрес
> http://server/Login пишет 404 - not found, а по идее - должно rewrite
> на http://server/index.php?Login
>
> nginx version: nginx/0.6.31, fast-cgi
>
> Чувствую, что грабли рядом, а никак не найду :(
Ужас.
server {
root ...
fastcgi params ...
location / {
error_page 404 = /index.php/$request_uri;
}
location ~* \.php(/|$) {
fastcgi_pass ...;
}
location = /sso_endpoint.php/ui {
rewrite ^ /index.php/SSO/UI last;
}
location = /sso_endpoint.php/SAML {
rewrite ^ /index.php/SSO/Proxy last;
}
location = /sso_endpoint.php/signout {
rewrite ^ /index.php/SSO/Proxy last;
}
location = /server-status {
fastcgi_pass ...;
}
location = /server-info {
fastcgi_pass ...;
}
location = /whm-server-status {
fastcgi_pass ...;
}
--
Игорь Сысоев
http://sysoev.ru
|