redirection issue

Kurogane nginx-forum at
Thu Oct 2 17:22:05 UTC 2014

Hello All,

I am facing some issue regarding nginx redirection i'm unable to fix it. I
want to create redirect non www to www but always redirect me to
default_server how i can fix this issue.

This is what i have

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


server {
	listen 80;
	return 301 $scheme://$request_uri;	
	root  /home/user/public_html;

When i go to or i got default document root

If i change server_name; to server_name; i got redirect loop issue.

Then how i suppose to solve this problem.

Posted at Nginx Forum:,253713,253713#msg-253713

More information about the nginx mailing list