• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Friendly URLS

#1
Alright, so I followed this thread and tried the suggestions, but no luck.

Added this to nginx.conf
Code:
location /home/nginx/domains/sectioneighty.com/public/forum/ {
    try_files $uri $uri/ /home/nginx/domains/sectioneighty.com/public/forum/index.php?$uri&$args;
    index index.php index.html;
}

location /home/nginx/domains/sectioneighty.com/public/forum/internal_data/ {
    internal;
}
location /home/nginx/domains/sectioneighty.com/public/forum/library/ {
       internal;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include         fastcgi_params;
}
And uncommented the "RewriteBase /xenforo" in the .htaccess file.

Still get a Page Not Found.

Confused as to what to try next. Is the format for my paths in my conf file wrong?
 

Mike

XenForo developer
Staff member
#5
You're running Nginx (presumably) so the .htaccess files are unsed. It's all down to the location blocks. The block paths used in the initial message aren't correct (they from the document root not the filesystem root)
 
#6
You're running Nginx (presumably) so the .htaccess files are unsed. It's all down to the location blocks. The block paths used in the initial message aren't correct (they from the document root not the filesystem root)
Thanks for this. So I changed the path to:

"/../../../../home/nginx/domains/sectioneighty.com/public/forum/"

Still no luck. Is there something going on with the brackets maybe? Am I supposed to leave the first or last one open?
 

LPH

Well-known member
#9
The link provided explains the location blocks are inside the server block. In the server block, there is first the listen, then server name, then root path, error page lines, then location blocks. Putting this together with the link provided by Mike, you'll see the location blocks are all relative to the root. You were using absolute paths and not relative to the root line in the server block.

Code:
location /home/nginx/domains/sectioneighty.com/public/forum/ {
    try_files $uri $uri/ /home/nginx/domains/sectioneighty.com/public/forum/index.php?$uri&$args;
    index index.php index.html;
}

location /home/nginx/domains/sectioneighty.com/public/forum/internal_data/ {
    internal;
}
location /home/nginx/domains/sectioneighty.com/public/forum/library/ {
       internal;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include         fastcgi_params;
}
I marked in red which is incorrect. Those are absolute paths and you need relative to the root.
 
Last edited:
#10
The link provided explains the location blocks are inside the server block. In the server block, there is first the listen, then server name, then root path, error page lines, then location blocks. Putting this together with the link provided by Mike, you'll see the location blocks are all relative to the root. You were using absolute paths and not relative to the root line in the server block.
I've read that link twice now, but this post just seems like I'm reading another language still. I apologize, but can you please get me started on this?

The forum is located in: /home/nginx/domains/sectioneighty.com/public/forum/
The nginx.conf file is located in: /usr/local/nginx/conf/

So where I previously wrote:
Code:
location /home/nginx/domains/sectioneighty.com/public/forum/
I should instead write?
 

LPH

Well-known member
#11
A server configuration might look something like the following BUT do not copy paste ! You'll want to read those links very carefully and dissect everything. It is another language :)

Code:
server {
  # Replace this port with the right one for your requirements
  listen 80 default_server;  #could also be 1.2.3.4:80

  # Multiple hostnames separated by spaces.  Replace these as well.
  server_name star.yourdomain.com *.yourdomain.com; # Alternately: _

  root /home/nginx/domains/sectioneighty.com/public;

  error_page 404 errors/404.html;

  index index.php index.html index.htm;

  # XenForo friendly URLs
  location /forum/ {
    try_files $uri $uri/ /forum/index.php?$uri&$args;
    index index.php index.html;
  }

  location /forum/internal_data/ {
    internal;
  }
  location /forum/library/ {
       internal;
  }
}