Nginx configuration preventing external scripts to run some Xenforo code?

Hi everybody!

I've successfully installed Xenforo with Nginx + PHP-FPM.
I've used Xenforo's config snipet:

    location /forum {
            try_files $uri $uri/ /forum/index.php?$uri&$args;

        location ~ /forum/(internal_data|library) {

    location /respostas {
            rewrite ^/respostas/([a-z\/]+)(\?.+)?$ /respostas/index.php?qa-rewrite=$1&$args last;

        location ~ \.php$ {
        include fastcgi.conf;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;


Now I'm trying to integrate Xenforo user login mechanism with Question2Answers. They make available an integration script in which I should fill some info in order to make both work along.

Some of the information needed is user's id, shown name and email. So I tried to use some Xenforo code to get this info:

// Sets up XenForo App
define('XF_ROOT', '/home/victor/Workspace/candidatovaga/public/forum'); // set this (absolute path)!
define('TIMENOW', time());
define('SESSION_BYPASS', false); // if true: logged in user info and sessions are not needed

require_once(XF_ROOT . '/library/XenForo/Autoloader.php');

XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT . '/library');

XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);
XenForo_Application::set('page_start_time', TIMENOW);

// The remaining of the file is Q2A code
// (...)

This file is in SITE_ROOT/respostas. Xenforo is installed under SITE_ROOT/forum.

When I try the script I get nothing printed and no error (in nginx error.log).

I guess somehow nginx.conf is blocking Xenforo's file to be imported to this script.
location ~ /forum/(internal_data|library) {

But if I comment these lines, I keep getting nothing printed.

I've commented each line from bottom to up and the problem ocours in:
XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);

Any ideas?

(Sorry about bad English... I'm no native speaker)
Last edited:


Well-known member
Start with simple tests:

1. Put a static file on /respostas. Can you access it?

If yes,

2. Put a simple php file (<?php phpinfo(); ?>) on /respostas. Does it run?