XF 1.5 XF in a subdirectory

Apologies in advance, this may be a silly question, but I can't find much information on it.

We have a XenForo install in /usr/share/nginx/www/forums, which is set as the doc root for the forum. Users can access the forum with the plain URL, https://ulmc.net

With friendly URLs enabled, XenForo works for loading the index page (articles) and the forum list, but not member profiles, threads, or posts. XenForo refuses to add /forums/$URI before, so instead of using the correct path for a thread, which would be /forums/threads/thread.name.here, it just uses /threads/thread.name.here, which will not work due to the URL structure. Adding a route filter does work, but this requires adding a route filter for every single URL type, which just isn't realistic.

My nginx config:

Code:
server {
    listen 80;
    server_name  ulmc.net www.ulmc.net;
    root   /usr/share/nginx/www/forums;
    index  index.php;

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

    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
}

The board URL is set to https://ulmc.net/forums

I essentially just need to know how to force everything to prefix /forums/$URI before the URL, since XF seems to refuse to do that. The XF site does it, and it's exactly what I need.
 
My nginx config:

If your doc root is already /forums, then your doc root for your url is simply https://ulmc.net/ (the forums is the route that is added on by XenForo itself).
Unless you actually have your your script in /usr/share/nginx/www/forums/forums - then that would be correct.
You need to change your
Code:
location /forums/ {
to
Code:
location / {
And see if your try_files may work better with
Code:
try_files $uri $uri/ /index.php?&$args;
 
If your doc root is already /forums, then your doc root for your url is simply https://ulmc.net/ (the forums is the route that is added on by XenForo itself).
Unless you actually have your your script in /usr/share/nginx/www/forums/forums - then that would be correct.
You need to change your
Code:
location /forums/ {
to
Code:
location / {
And see if your try_files may work better with
Code:
try_files $uri $uri/ /index.php?&$args;
That worked, thank you.
 
Back
Top Bottom