serve content from a wget mirror

Francis Daly francis at daoine.org
Mon Nov 24 12:36:27 UTC 2014


On Mon, Nov 24, 2014 at 11:05:10AM +0000, Steve Wilson wrote:

Hi there,

> I'm trying to create an archive based on a current site which is due to
> be taken down, I've used "wget -m" to mirror the site and all seems well
> except I'm having trouble with what I think are arguments in the url.
> 
> Most everything seems to work ok and this is currently my only issue. I
> have on disk the file /dir/page.php?a=1&b=2 for example but nginx
> returns a 404 when accessing http://localhost/dir/page.php?a=1&b=2,

url-space and filename-space are different.

Option 1: in all of the html that contains links that refer
to /dir/page.php?a=1&b=2, url-encode it to be (at least)
/dir/page.php%3Fa=1&b=2 (that is: ? becomes %3F).

With that, you need nothing special from nginx.

Option 2: use your try_files thing but use $uri?$args as the first
argument (note the ? in there).

With that, you need the try_files magic to handle all requests. And
if you happen to have both "page.php" and "page.php?", you may have
difficulty accessing the former.

Option 3: keep the mirror of "static" content; but reimplement the
back-end for "dynamic" content.

That's a lot more work, but is really the only way to provide the
full mirror.

But if your current "offline mirror" is complete enough and does not
contain any html forms which POST or have combinations of options that
have not been used already, it is probably unnecessary.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list