Want more timely Centmin Mod News Updates?
Become a Member

IP.Board Invision forum REST API enable Nginx rule

Discussion in 'Forum software usage' started by pamamolf, Jan 15, 2019 at 4:01 AM.

  1. pamamolf

    pamamolf Premium Member Premium Member

    3,148
    303
    83
    May 31, 2014
    Ratings:
    +542
    Local Time:
    8:09 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hello

    To enable the REST api for IPB the instructions are to upload the .htaccess file to:

    Code:
    /home/nginx/domains/mydomain.com/public/api
    The content is:

    Code:
    <IfModule mod_setenvif.c>
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
    </IfModule>
    <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteBase /api/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    </IfModule>
    Does anyone has a working Nginx rule for it?

    Thank you
     
    Last edited: Jan 15, 2019 at 4:33 AM
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,148
    303
    83
    May 31, 2014
    Ratings:
    +542
    Local Time:
    8:09 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Just spot some info on the official site about it and it works now :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    37,669
    8,247
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,697
    Local Time:
    4:09 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    And?
     
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,148
    303
    83
    May 31, 2014
    Ratings:
    +542
    Local Time:
    8:09 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Working rewrite rule is:

    Code:
    location /api/ {
            if (!-e $request_filename){
                    rewrite ^/api/(.*)$ /api/index.php;
            }
    }
     
    • Like Like x 1
  5. JoeDer

    JoeDer Premium Member Premium Member

    33
    10
    8
    Feb 22, 2015
    Ratings:
    +25
    Local Time:
    8:09 AM
    Nginx 1.13.x
    MariaDB 10.1.x
    For IPS REST API I use:
    Code:
       # IPS API
        location /api/ {
             include /usr/local/nginx/conf/503include-only.conf;
             include /usr/local/nginx/conf/block.conf;
             try_files $uri $uri/ @api;
        }
    
       # IPS API LOCATION
        location @api {
            rewrite ^ /api/index.php?$args last;
    From @Jimmy 's file
     
    • Informative Informative x 2
  6. eva2000

    eva2000 Administrator Staff Member

    37,669
    8,247
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,697
    Local Time:
    4:09 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    looks like a better alternative to me thanks for sharing :)
     
    • Like Like x 1
  7. Jimmy

    Jimmy Premium Member Premium Member

    1,440
    296
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +731
    Local Time:
    1:09 AM
    1.13.x
    MariaDB 10.1.x
    I haven't worked on the API part since I wasn't using it. I believe I blocked it out in my latest vhost on github.

    Maybe @Revenge knows for sure what to use?
     
..