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

XF 1.3 Friendly URL Redirects for NginX

Discussion in 'Troubleshooting and Problems' started by Joshua, May 7, 2014.

  1. Joshua

    Joshua Active Member

    For some reason my VPS isn't redirecting properly for friendly URLs. The forum is installed to http://www.domain.com/forum/. I'm using Nginx with Centmin Mod and I have the following in my domain.com.conf file:

    Code:
    server {
      server_name domain.com;
      rewrite ^   http://www.domain.com/forum$request_uri? permanent;
    }
    server {
    listen 80;
    server_name www.domain.com;
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
      # limit_conn limit_per_ip 16;
      # ssi  on;
      access_log /home/nginx/domains/domain.com/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/domain.com/log/error.log;
      root /home/nginx/domains/domain.com/public;
    
    location / {
    
    location /forum/ {
            try_files $uri $uri/ /xf/index.php?$uri&$args;
            index index.php index.html;
    }
    
    location /forum/internal_data/ {
            internal;
    }
    location /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;
    
    }
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      #try_files             / /index.php;
    
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
    }
    

    Any help you can provide would be much appreciated!
     
  2. BamaStangGuy

    BamaStangGuy Well-Known Member

    Code:
    try_files $uri $uri/ /xf/index.php?$uri&$args;
    Try:

    Code:
    try_files $uri $uri/ /index.php?$uri&$args;
    You left the example /xf/ in there.
     
    Joshua likes this.
  3. BamaStangGuy

    BamaStangGuy Well-Known Member

    If that doesn't work replace /xf/ with /forum/
     
    Joshua likes this.
  4. MattW

    MattW Well-Known Member

    Code:
            location /forum/ {
                    try_files $uri $uri/ /forum/index.php?$uri&$args;
                    location /forum/internal_data {
                            location ~ \.(data|html|php)$ {
                                    internal;
                            }
                            internal;
                    }
                    location /forum/library {
                            location ~ \.(default|html|php|txt|xml)$ {
                                    internal;
                            }
                            internal;
                    }
            }
     
  5. Joshua

    Joshua Active Member

  6. SatGuyScott

    SatGuyScott Active Member

    How would I need to modify this for my site as I will be converting over this weekend.

    I am on NGINX and my current vBulletin setup is in the document root, however my new XenForo install will be in /xen/

    I want to make sure my highly indexed friendly URL's from vBulletin take you to the correct threads in XenForo.

    Thanks guys!
     

Share This Page