Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

server name rewrite

$
0
0
Hi, guys!

E.g. I have server new_server_name.com and want to rewrite requests to www.new_server_name.com and old_server_name.com to present server.

From http://wiki.nginx.org/Pitfalls I use two server's {} directives for this instead if().

server {
server_name www.new_server_name.com old_server_name.com;
return 301 $scheme://new_server_name.com$request_uri;
}

server {
listen 10.15.1.2:80;
server_name new_server_name.com;

... server staff...
}

But this doesn't work and first server {} directive MUST have listen directive as well.

So, or I am do something wrong or wiki-page doesn't clear describe this situation?

--
Cheers,
w

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>