Using Invoiceninja in a subfolder on shared hoster

Hi there!
I am sure that invoiceninja is exactly the software I need for my invoicing.

I’d like to install it in a subfolder but all I see is a blank page if i type mydomain.com/ninja or mydomain.com/ninja/public

I managed to install it on a subdomain but I can’t use it because I don’t have a wildcard on my SSL certificate.
So chmod is correct since it worked on a subdomain, PHP version is 7.1. (figured that out :slight_smile:

What can I do? Your help is much appreciated.

Are there any errors in the web server error logs?

Dear Hillel,
thanks for your lightning fast reply. I messed with the installation a lot. So I decided to delete everything and reupload the whole thing again.

I will come back to you as soon as I’m done.

Reupliad is done. White page remains.
Under /ninja/storage/logs ther is only a .gitignier file.

I guess it is something with the .htaccess file/s but I am not sure.

I noticed that if I call
mydomain.com/ninja/public
I get redirected to
mydomain.com/ninja/public/setup

But the page remains white.

Any idea?

I’d suggest asking your web host for help finding the web server error logs.

2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:48:12 +0200] "GET /ninja/ HTTP/1.1" 302 360 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:48:13 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:48:18 +0200] "GET /ninja HTTP/1.1" 301 232 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:48:18 +0200] "GET /ninja/ HTTP/1.1" 302 360 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:48:19 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:49:12 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:49:13 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:50:58 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:50:59 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:50:59 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:51:00 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:51:07 +0200] "GET /css/style.min.css HTTP/1.1" 200 2524 md-west.de "http://md-west.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:51:07 +0200] "GET /js/scroll.js HTTP/1.1" 200 1238 md-west.de "http://md-west.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:51:08 +0200] "GET /img/section.jpg HTTP/1.1" 200 120475 md-west.de "http://md-west.de/css/style.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:51:13 +0200] "GET /ninja/ HTTP/1.1" 302 360 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:51:13 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:53:00 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:53:01 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:53:02 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:15:53:03 +0200] "GET /ninja/login HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:19:41:55 +0200] "GET / HTTP/1.1" 200 6779 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:19:41:55 +0200] "GET /css/style.min.css HTTP/1.1" 200 2524 md-west.de "http://md-west.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:19:41:55 +0200] "GET /js/scroll.js HTTP/1.1" 200 1238 md-west.de "http://md-west.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:19:41:55 +0200] "GET /img/section.jpg HTTP/1.1" 200 120475 md-west.de "http://md-west.de/css/style.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:19:41:55 +0200] "GET /img/head.jpg HTTP/1.1" 200 680106 md-west.de "http://md-west.de/css/style.min.css" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:19:41:57 +0200] "GET /favicon.ico HTTP/1.1" 200 32038 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:15:40 +0200] "GET /ninja/ HTTP/1.1" 403 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:18:58 +0200] "GET /ninja/public HTTP/1.1" 301 239 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:18:58 +0200] "GET /ninja/public/ HTTP/1.1" 302 388 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:18:58 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:21:14 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:22:24 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:24:31 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:24:38 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:25:24 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:25:24 +0200] "GET /favicon.ico HTTP/1.1" 200 32038 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-" 2001:16b8:4565:9b00:4945:a7e1:a918:28f7 - - [17/May/2018:20:34:10 +0200] "GET /ninja/public/setup HTTP/1.1" 404 1363 md-west.de "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" "-"

Here we go. This is the server log.

A lot of 404 errors. But I did upload everything using filezilla. All files are there and, as I already said, I managed to install it using a subdomain.

This is really confusing.

This is from the access log, you’d need to check your error log.

You may want to consider using an automated installer: https://github.com/invoiceninja/invoiceninja#installation-options

Do you mean php error logs? I activated them now and tested on a purposefully wrong written php file. It worked, there was an error log.

But when I call /ninja/public/ no error log is written.

I did it!
I don’t know why but i had to call the index.php directly.
So I simply typed mydoamain.com/ninja/public/index.php and it worked…

1 Like

Hmm… you shouldn’t have to do that, you may want to check the mod_rewrite is enabled.

Hi,
mod_rewrite should be activated. But I am happy I can use IN with index.php. It is no problem for me to add it to the address.

I already managed to set everything up and redesign my invoice like I want it to. It’s fine with me.

Have a nice day.

Hi @qds1

I have just run into the same issue that I’ve been dealing with for a bit of time and pointing to the index.php solved it for me. Did you ever get it working it as it should? If so, what was the solution?

Much appreciated.

Hi CTG,

unfortunately I didn’t find a solution for this issue. But I’ve got news that invoiceninja v5 is out. It was rewritten in flutter. I’ll give it a try, there are a lot of benefits, I think.
And maybe this issue will be resolved with the new version.

Thanks for the reply @qds1 but I actually am having this issue with v5.

Regards.

Hi @CTG,
Your’e very welcome.
I didn’t install v5 yet, just tried the demo. I am going to keep you up to date when I do. Maybe we can figure something out together.

1 Like

Sounds good, thanks for the offer!

That worked for me in v5 as well. Without it I get 404

I think I found a solution for v5. I followed this: Configure Laravel to work in a SubDirectory and with artisan serve at the same time | by Luca Becchetti | Medium

Then I deleted the contents of the bootstrap/cache folder

With composer 2 (composer 1 will not work!) I ran php artisan optimize and composer install being within the invoiceninja directory on the bash.

(Maybe for you composer install might be not necessary, I had to run it, because I ran it with composer 1 first and destroyed the installation.)

Lastly I added the subdirectory as rewrite base to the .htaccess in the invoiceninja directory:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /MY_SUBFOLDER_HERE
  RewriteRule ^(.*)$ public/$1 [L]
  RewriteRule "^.env" - [F,L]
  RewriteRule ^(.well-known)($|/) - [L]
</IfModule>

...

and to the to the .htaccess in the public directory:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On  
    RewriteBase /MY_SUBFOLDER_HERE

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Tested on my dev environment. As soon I get it to work on my production env I’ll gladly post an update.

Hope that helps.

Ok, I give up.
With this change I can’t login, getting a 404 error
404: Method not supported for this route, you may need to add /public to the URL
If I added /public or /public/index.php to the URL I got a 404 error.

The invoice preview did not work.

Everything else worked. (I had login cookies in another browser, so I could test it)

So I deleted APP_DIR="MY_SUBFOLDER" from the .env file and reran php artisan optimize and composer install

Now I have to add /public/index.php to my URL again.
Oh man, I’m frustrated. A day of work for nothing :confounded:

Maybe a dev can solve the issue. I’d appreciate it.