redirection issue

Adie Nurahmadie nurahmadie at gmail.com
Thu Oct 2 17:39:46 UTC 2014


On Fri, Oct 3, 2014 at 12:33 AM, Kurogane <nginx-forum at nginx.us> wrote:

> No.
>

There is your problem, the config supposed to looks like this:

server {
                listen 80 default_server;
                server_name localhost;
                root /home/nginx/default/public;
}


server {
        listen 80;
        server_name domain.com;
        return 301 $scheme://www.domain.com$request_uri;
}

server {
        listen 80;
        server_name www.domain.com;
        root  /home/user/public_html;

        # proceed with the rest of the config down here
        # ...
}

Also, it's not mandatory, but I think you should set the default_server on
the www.domain.com server block
instead of localhost.

Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,253713,253715#msg-253715
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
regards,
Nurahmadie
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141003/93e62d8f/attachment.html>


More information about the nginx mailing list