'auto'rewrite link to a folder

Francis Daly francis at daoine.org
Thu Aug 14 17:23:20 UTC 2014

On Thu, Aug 14, 2014 at 04:33:04PM +0200, Pascale Camille wrote:

Hi there,

> root at www:/# curl -H Host:one.2maxi.com http://localhost/
> content of /tmp/www/one/index.html
> root at www:/# curl -H Host:nil.2maxi.com http://localhost/
> <html>
> <head><title>404 Not Found</title></head>
> <body bgcolor="white">
> <center><h1>404 Not Found</h1></center>
> <hr><center>nginx/1.2.1</center>
> </body>
> </html>
> root at www:/#

So: they both say that if the request gets to nginx, nginx responds as
you want it to.

> so in web browser i should see
> content of /tmp/www/one/index.html

...if the browser makes the request of nginx.

> but i have 'this page not available ... DNS lookup failed"

And that says that the browser did not know where nginx was.

You need your browser to be able to turn the hostnames one.2maxi.com and
nil.2maxi.com (and any others that you will use) into the IP address of
your nginx server.

This is usually either "set up dns right", or "populate your browser
machines etc/hosts file" -- but it might be "get resolution working on
your proxy server" or something else instead.

It's outside the scope of nginx, but may be useful to add to DNS many
individual A records, or a single wildcard one, for the hostnames that
you care about.

> and 2maxi.com/nil or what else gives 2maxi.com

That suggests that your browser can resolve 2maxi.com to the nginx server,
and hopefully it is clear from your configuration why the response was
what it was.

Francis Daly        francis at daoine.org

More information about the nginx mailing list