Get the most out of your Centmin Mod LEMP stack
Become a Member

vBulletin Help with Rewrite Rules

Discussion in 'Forum software usage' started by Mask, Nov 28, 2014.

  1. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    9:17 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    Hi Guys,

    This is the second server where I am using CentminMod :)
    The main domain has Wordpress installed on root and VB (v4.2.1) installed on directory /forums/. It us using standard mod rewrite rules. (I am attaching my current .htaccess from inside forums directory).


    When I use rules as stated on Nginx and vBulletin 4.1.x inbuilt Friendly Urls It keeps downloading php files. Please help me here.
     

    Attached Files:

    Last edited: Nov 28, 2014
  2. eva2000

    eva2000 Administrator Staff Member

    53,149
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    2:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    not sure i understand, Nginx doesn't support htaccess any all so it's expected any .htaccess requirements won't work with Centmin Mod
     
  3. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    9:17 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    Hi,
    Sorry I think I didn't make it clear first. I am using VB forum on sub-domain (domain.com/fourms/) and with Apache I was using the above rewrite rules for using VB SEO friendly URLs. (i.e. That comes standard with VB, No VBSeo hack)

    But when move this forum to Nginx (using CentminMod) and following instructions given at Nginx and vBulletin 4.1.x inbuilt Friendly Urls It's not working. As soon as I access domain.com/fourms/ it downloads the php file.

    So I need help getting VB Seo Friendly URL working.

    Thanks
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,149
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    2:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    post your nginx vhost conf file contents for your forums here (in CODE tags)
     
  5. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    9:17 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    Here it is.

    Code:
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    #server {
    #            listen   80;
    #            server_name domain.com;
    #            return 301 $scheme://www.domain.com$request_uri;
    #       }
    
      server {
    
      server_name domain.com 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;
      access_log /var/log/nginx/access.cache.log cache;
    
      root /home/nginx/domains/domain.com/public;
    
      location / {
    
      # 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            $uri $uri/ /index.php;
    #Added for WP-Install at Root
    #Permalink
    try_files $uri $uri/ /index.php?$args;
    include /usr/local/nginx/conf/wpsecure.conf;
    include /usr/local/nginx/conf/wpnocache.conf;
    #Wp-Cache
    include /usr/local/nginx/conf/phpwpcache.conf;
    include /usr/local/nginx/conf/wpcache.conf;
      }
    
      location /forums {
            try_files $uri $uri/ @rewrite;
    }
    
            }
    
    location @rewrite {
            # Forum
            rewrite /forums/threads/.*                          /forums/showthread.php?$uri&$args      last;
            rewrite /forums/forums/.*                           /forums/forumdisplay.php?$uri&$args    last;
            rewrite /forums/members/.*                          /forums/member.php?$uri&$args          last;
            rewrite /forums/blogs/.*                            /forums/blog.php?$uri&$args            last;
            rewrite /forums/entries/.*                          /forums/entry.php?$uri&$args           last;
    
            # MVC
            rewrite ^/forums/(?:(.*?)(?:/|$))(.*|$)$            /forums/$1.php?r=$2                    last;
    }
      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;
    }
    Other than standard install, I have only added "Advanced Nginx Wordpress configuration + fastcgi_cache + Nginx Helper plugin" without the plugin from Nginx Wordpress Configuration Examples for rewrite rules & FastCGI Caching
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,149
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    2:17 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    i believe it's because you commented out the php.conf include line

    Code:
    #include /usr/local/nginx/conf/php.conf;
    try this

    Code:
      location /forums {
    include /usr/local/nginx/conf/php.conf;
            try_files $uri $uri/ @rewrite;
    }
     
  7. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    9:17 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    Errr .. That was a stupid mistake :(

    Retracing my steps, I believe I commented it out since I am using fastcgi_cache from wp-config page and have /usr/local/nginx/conf/phpwpcache.conf instead.
    Should have thought of it ..

    Works perfectly now :)
    You are awesome .. :)