Get the most out of your Centmin Mod LEMP stack
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 Premium Member Premium Member

    3,861
    379
    83
    May 31, 2014
    Ratings:
    +731
    Local Time:
    9:53 PM
    Nginx-1.17.x
    MariaDB 10.3.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 Premium Member Premium Member

    3,861
    379
    83
    May 31, 2014
    Ratings:
    +731
    Local Time:
    9:53 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Just spot some info on the official site about it and it works now :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    45,468
    10,319
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,005
    Local Time:
    5:53 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    And?
     
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,861
    379
    83
    May 31, 2014
    Ratings:
    +731
    Local Time:
    9:53 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Working rewrite rule is:

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

    JoeDer Member

    64
    13
    8
    Feb 22, 2015
    Ratings:
    +41
    Local Time:
    9:53 PM
    Nginx 1.17.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

    45,468
    10,319
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,005
    Local Time:
    5:53 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    looks like a better alternative to me thanks for sharing :)
     
  7. Jimmy

    Jimmy Well-Known Member

    1,706
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    3:53 PM
    1.17.x
    MariaDB 10.3.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?