MyBB Community Forums

Full Version: nginx archive issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There's an issue with ./archive/global.php where it doesn't quite work as expected on nginx based servers (or at least, it wouldn't on mine). I believe the below block of code should run for nginx, yet it seems not to - therefore meaning the archive URLs look like index.php/forum-x.html which won't work on nginx without a rewrite rule (and there's no mention of such Wink).

if((DIRECTORY_SEPARATOR == '\\' && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') == false) || stripos(SAPI_NAME, 'cgi') !== false || defined("ARCHIVE_QUERY_STRINGS"))
{
	$url = $_SERVER['QUERY_STRING'];
	$base_url = $mybb->settings['bburl']."/archive/index.php?";
	$endpart = $url;
}

I managed to remedy the issue by defining ARCHIVE_QUERY_STRINGS, but surely it shouldn't have arisen? It could just be my server setup, but I wasn't sure so I thought I'd mention it anyway.
(2011-08-23, 07:42 PM)euantor Wrote: [ -> ]therefore meaning the archive URLs look like index.php/forum-x.html which won't work on nginx without a rewrite rule (and there's no mention of such Wink).

No rewrite rule, just pass the path info on to PHP. It's a bit tricky to set up properly. Especially since PHP itself is no help at all. You absolutely have to check in nginx whether the PHP file really exists, otherwise you have a serious security issue on your site.

Quote:I managed to remedy the issue by defining ARCHIVE_QUERY_STRINGS, but surely it shouldn't have arisen?

ARCHIVE_QUERY_STRINGS should be a setting but MyBB moves in mysterious ways.
I didn't think of simply passing the path info Wink I was thinking first of just rewriting the slash to a question mark till I looked through the source. It works the way I've done it, but it would be nice to see a setting to easily get it working. To be honest, I never would have even noticed if I wasn't getting crawl errors from google's webmaster tools.