Re: Как правильно сделать редирект на определенный порт

Борис Долгов boris at dolgov.name
Fri Dec 19 18:05:58 MSK 2008


server {
    listen xxx.xxx.xxx.xxx:8000;
    .....
}
server {
    listen xxx.xxx.xxx.xxx:80;
    rewrite ^ http://$host:8080/$request_uri? redirect;
}

19 декабря 2008 г. 17:28 пользователь Pavel Stoliarov <stpavel at bk.ru>написал:

> Здравствуйте
> На сервере установлен nginx в качестве frontend'a к апачу.
> nginx слушает на портах 80 и 8080
> Необходимо что бы все запросы типа http://servername nginx редиректил на
> http://servername:8080
>
> Я  добился нужного результата таким способом :
>
> server {
>    listen  xxx.xxx.xxx.xxx:80;
>    listen  xxx.xxx.xxx.xxx:8080;
>    ...
>    ...
>      if ($server_port !~* "8080") {
>            rewrite ^/(.*)$ http://$host:8080/$1 redirect;
>     }
>
> ....
>
> Вроде бы все работает. Но я в nginx новичок, подскажите пожалуйста,
> правильно ли я сделал редирект ?
>
>
>


-- 
С уважением, Борис Долгов.
icq 77556665
e-mail boris at dolgov.name
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20081219/b01c7ef5/attachment.html>


More information about the nginx-ru mailing list