1. 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

Discussion in 'Troubleshooting and Problems' started by SectionEighty, Nov 27, 2014.

  1. SectionEighty

    SectionEighty Member

    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?
     
  2. Mike

    Mike XenForo Developer Staff Member

  3. king8084

    king8084 Active Member

    Im working with op on this and we did all of that with no luck

    .htacess and htacess.txt both exist in the same folder tho..do i need to delete. Txt file?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    The htaccess.txt file is just a backup of the default .htaccess file.
    It isn't used.
     
  5. Mike

    Mike XenForo Developer Staff Member

    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. SectionEighty

    SectionEighty Member

    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?
     
  7. LPH

    LPH Well-Known Member

  8. SectionEighty

    SectionEighty Member

    So if I'm reading this right, instead of the /.../ I should instead lead with 'root /' ?
     
  9. LPH

    LPH Well-Known Member

    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: Nov 27, 2014
    MattW and SectionEighty like this.
  10. SectionEighty

    SectionEighty Member

    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?
     
  11. LPH

    LPH Well-Known Member

    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;
      }
    }
    
     
    MattW likes this.
  12. king8084

    king8084 Active Member

    NVM, I got it working. Turns out I had the location directive in the wrong conf file. D'oh!
     

Share This Page