Welcome! Log In Create A New Profile

Advanced

question on server_name_in_redirect

Anonymous User
August 25, 2010 05:14AM
server {
listen 80;
server_name example.com:7788 example.com;
server_name_in_redirect on;
root /var/www/html/exampel/;
index index.php index.html;

According to the wiki, this should automatically redirect any request
to example.com to example.com:7788

If server_name_in_redirect is on, then Nginx will use the first value
of the server_name directive for redirects. If server_name_in_redirect
is off, then nginx will use the requested Host header.
http://wiki.nginx.org/NginxHttpCoreModule#server_name_in_redirect

But it didn't work in my case. On nginx 0.8.44


So i had to use

if ($host ~* shop.2u4u.com.cn ) {
rewrite ^(.*)$ http://shop.2u4u.com.cn:7788$1 ; # $1 contains
'/foo', not 'www.mydomain.com/foo'
}

Which is not clean and fell in the category of nginx pitfall :(
http://wiki.nginx.org/Pitfalls

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

question on server_name_in_redirect

Anonymous User August 25, 2010 05:14AM

Re: question on server_name_in_redirect

Maxim Dounin August 25, 2010 07:32AM

Re: question on server_name_in_redirect

Anonymous User August 25, 2010 10:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready