4

I have the following nginx config which is servering a few static pages. It sits behind a load balancer and is not listening on the public host name. The problem with the below is nginx sends a 301 back to add a trailing slash but it sets the location to internal.mysite.production/blog/ not www.mysite.com/blog/

server {
    listen 80;
    server_name    internal.mysite.production
    location /blog {
        root /var/www/somewhere/;
    }
}

Is there an option to change this?

3
  • if this is wordpress, check the wordpress config, cause it does a redirect if the url doesn't match the settings. Commented Jun 21, 2013 at 14:08
  • thanks, not wordpress though, I am using nginx just as reverse proxy, gzip etc. Commented Jun 21, 2013 at 14:08
  • well this config can't do any redirection, it's either the app it self, or the url is matching another rule in another server maybe, ur default server. Commented Jun 21, 2013 at 15:20

1 Answer 1

1

you can specify:

server_name_in_redirect on;

in your nginx config. also see: http://wiki.nginx.org/HttpCoreModule#server_name_in_redirect

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.