Installing IP 1.5.11 Nginx subdirectory

Hi!
I’ve been using InvoicePlane for the past year, since I started my activity. I am so grateful for all the work maintainers and contributors do and have done so far!
I first installed IP on my computer and accessed it on localhost. Now that I’ve been playing around with selfhosting so now I wanted to move it to my little homeserver.
I’ve installed IP, imported my databases, set everything up and it is working great! Now i can access it from any of my devices! One problem thought… I cannot manage to set it up to use a subdirectory URL…
For now I access it on http://xxx.xxx.xxx.xxx/index.php/sessions/login
I would like to access it on http://xxx.xxx.xxx.xxx/invoices/index.php/sessions/login
Whatever i tried I end up with a 404 error…

My nginx invoiceplane.conf:

server {
    listen 80;
    listen [::]:80;
    server_name xxx.xxx.xxx.xxx; #(the ip of my server)

  root /var/www/html/invoiceplane;

  index index.php index.html;

   location / {
   try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ \.php$ {
    fastcgi_index index.php;
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  }
}

And in config.php I set:

IP_URL=http://xxx.xxx.xxx.xxx #(ip of my server)

If anyone help me set it up it would be gladly appreciated !
Thanks,

If you want to use InvoicePlane in a subdirectory please set this to:

IP_URL=http://xxx.xxx.xxx.xxx/invoice

And you have to adapt the htaccess if you want to remove the “index.php” from the URL. So better start without removing it.
After this it should work. If it works, pls activate the REMOVE_INDEXPHP=true feature and adapt the rewrite rules.

Some little additional recommendations:

  • do not use and IP but a Domain.
  • I personally preffer to set InvoicePlane up on a Subdomain (e.g.: invoice.domain.tld) instead of in a subdirectory, but both will work.
  • use HTTPS not HTTP becasue if you use HTTP all sensible Datas are unencrypted. Please dont do this. (using Let’s encrypt is fine for this)

Thank you Martin,
Concerning the .htaccess file, I believe it is only for Apache Web server, as I am using nginx (and just learning it) I’m looking online how to convert it into Nginx conf language, any advice ?
Thank again for your advices, I now use a local domain, as I am learning Nginx I am for now more used to set subdirectories but I will eventually move to a subdomain, an finally as I access my server from outside through a WireGuard tunnel, planning to reverse proxy latter on.

Edit 1:
I believe don’t need the .htaccess file as I’m using Nginx. I successfully remove the “index.php” in the url with:

REMOVE_INDEXPHP=true

I am currently trying to set up the subdirectory now. First I set IP_URL=http://server.lan/invoices, then there is my nginx conf:

#invoiceplane.conf
server {
    listen 80;
    listen [::]:80;
    server_name server.lan;

  root /var/www/html/invoiceplane;

  index index.php index.html;

   location /invoices {
   try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ \.php$ {
    fastcgi_index index.php;
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  }
}

But with location /invoices I end up with a 404 error…

Edit 2:
Well i thought subdirectories were easier… I ended up with a subdomain and now :tada: :tada: it works! :tada: :tada: Here’s my Nginx conf:

#invocieplane.conf
server {
    listen 80;
    listen [::]:80;
    server_name invoices.server.lan;

  root /var/www/html/invoiceplane;

  index index.php index.html;

   location / {
   try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ \.php$ {
    fastcgi_index index.php;
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  }
}