Join the community today
Register Now

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,356
    318
    83
    May 31, 2014
    Ratings:
    +593
    Local Time:
    9:39 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,356
    318
    83
    May 31, 2014
    Ratings:
    +593
    Local Time:
    9:39 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

    40,649
    9,029
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,902
    Local Time:
    4:39 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    And?
     
    style="display:inline-block;min-width:400px;max-width:970px;width:95%;height:90px" data-ad-client="ca-pub-6669518204467592" data-ad-slot="4024536743" data-ad-format="auto">
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,356
    318
    83
    May 31, 2014
    Ratings:
    +593
    Local Time:
    9:39 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;
            }
    }
     
    • Like Like x 1
  5. JoeDer

    JoeDer Premium Member Premium Member

    47
    11
    8
    Feb 22, 2015
    Ratings:
    +33
    Local Time:
    9:39 PM
    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

    40,649
    9,029
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,902
    Local Time:
    4:39 AM
    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,559
    321
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +802
    Local Time:
    2:39 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?