Join the community today
Become a Member

IP.Board Invision forum REST API enable Nginx rule

Discussion in 'Forum software usage' started by pamamolf, Jan 15, 2019.

  1. pamamolf

    pamamolf Well-Known Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +838
    Local Time:
    8:20 PM
    Nginx-1.26.x
    MariaDB 10.6.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
  2. pamamolf

    pamamolf Well-Known Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +838
    Local Time:
    8:20 PM
    Nginx-1.26.x
    MariaDB 10.6.x
    Just spot some info on the official site about it and it works now :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,458
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    3:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    And?
     
  4. pamamolf

    pamamolf Well-Known Member

    4,101
    428
    83
    May 31, 2014
    Ratings:
    +838
    Local Time:
    8:20 PM
    Nginx-1.26.x
    MariaDB 10.6.x
    Working rewrite rule is:

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

    JoeDer Member

    82
    19
    8
    Feb 22, 2015
    Ratings:
    +48
    Local Time:
    8:20 PM
    Nginx 1.21.x
    MariaDB 10.3.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
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,458
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,841
    Local Time:
    3:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks like a better alternative to me thanks for sharing :)
     
  7. Jimmy

    Jimmy Well-Known Member

    1,788
    390
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +990
    Local Time:
    1:20 PM
    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?