Learn about Centmin Mod LEMP Stack 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 Premium Member Premium Member

    3,211
    305
    83
    May 31, 2014
    Ratings:
    +552
    Local Time:
    5:10 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
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,211
    305
    83
    May 31, 2014
    Ratings:
    +552
    Local Time:
    5:10 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

    38,695
    8,548
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,131
    Local Time:
    1:10 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    And?
     
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,211
    305
    83
    May 31, 2014
    Ratings:
    +552
    Local Time:
    5:10 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

    41
    11
    8
    Feb 22, 2015
    Ratings:
    +31
    Local Time:
    5:10 AM
    Nginx 1.15.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
     
    • Informative Informative x 2
  6. eva2000

    eva2000 Administrator Staff Member

    38,695
    8,548
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,131
    Local Time:
    1:10 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,510
    310
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +765
    Local Time:
    11:10 PM
    1.15.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?
     
..