Laravel Issue on setup

Greetings:

I am self-hosting an InvoiceNinja instance in a LXC container (Ubuntu 20.04) on a private network. The WAN will be able to reach the InvoiceNinja instance by way of a HAProxy instance on the same LAN exposed to the Internet. The HAProxy instance holds the certificate and handles the 443 request to InvoiceNinja passing it on to the InvoiceNinja instance. The InvoiceNinja Apache2 server listens on port 80.

Anyway, I think I have done everything correctly but when I attempt to browse to https://invoice..com, I am greeted with this:

*/ define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | */ require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__.'/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response);

I have absolutely zero experience with Laravel so this might as well be in a foreign language (to me).

Any suggestions?

Thank you!

Hi,

It may help to add TRUSTED_PROXIES=* to the .env file

https://invoiceninja.github.io/docs/env-variables/

hillel,

thank you for the prompt response! Unfortunately I think my install may be more incorrect than first thought. For example, there isn’t even an .env file that I can find. I failed to mention this (sorry, it was late):

  1. I can’t even navigate to the site to start initial setup
  2. I followed this guide (substituting Apache2 for Nginx) Install Invoice Ninja v5 on Ubuntu 20.04

I’ve installed v4.x in the past but lost the LXC container in a catastrophic computer failure (and on top of that, my storage pool backup was corrupted so I could not use the backup). I’d like to use v5.x but if I can’t get this working I may just try my hand at 4.x, again.

Some filesystems hide files starting with a dot.

If the file wasn’t created you can manually copy the .env.example file

Sorry it has taken me so long. This is my “.env” file (And I assume the name is to be only “.env” but please correct me if I am wrong).

PP_NAME="Invoice Ninja"
APP_ENV=production
APP_KEY=base64:<redacted>
APP_DEBUG=false

APP_URL=https://invoice.<redacted>.com

DB_CONNECTION=mysql
MULTI_DB_ENABLED=false

DB_HOST=localhost
DB_DATABASE=ninjadb
DB_USERNAME=ninja
DB_PASSWORD=<redacted>
DB_PORT=3306

DEMO_MODE=false

BROADCAST_DRIVER=log
LOG_CHANNEL=stack
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS='user@example.com'
MAIL_FROM_NAME='Self Hosted User'

POSTMARK_API_TOKEN=
REQUIRE_HTTPS=true

GOOGLE_MAPS_API_KEY=
ERROR_EMAIL=
TRUSTED_PROXIES=192.168.86.103

NINJA_ENVIRONMENT=selfhost

#options - snappdf / phantom / hosted_ninja
PDF_GENERATOR=phantom

PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
PHANTOMJS_SECRET=secret

UPDATE_SECRET=secret

COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
SENTRY_LARAVEL_DSN=https://32f01ea994744fa08a0f688769cef78a@sentry.invoicing.co/9

Still getting the same landing page as described in the OP. :confused:

@david do you have any ideas?

If you are seeing text, it means your PHP interpreter isn’t being invoked and the text is being outputted rather than the script being interpreted.

Unfortunately I do not know enough about php to make heads or tails of that. Do you have any advice on how to troubleshoot that?

@Masmith79

have you enabled mod_php in apache2?

It is enable however, when I went to check again, I received this:

root@ninja:~# a2enmod php7.4
Considering dependency mpm_prefork for php7.4:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.4:
Module php7.4 already enabled

so it sounds and looks like a configuration issue with mod_php - i haven’t used apache in a long time, but from memory you need to enabled only modphp7.4 + change the directory to execute the index.php file

Yeah seems everyone prefers nginx over apache2 in the invoiceninja community (considering recent events, I don’t blame them). However I have tried it with nginx before and run into the same problem. I am truly at a loss.

At this point I am willing to beg to see someone’s setup. Ill switch to nginx. I just need to get something up and running to import my backup from my v4.x that crashed

Have you seen out same nginx config in the docs? You just need to install phpfpm also.

I literally followed the docs and specifically: Install Invoice Ninja v5 on Ubuntu 20.04

To be clear, I am not complaining; I am very grateful for your help and the community at large. I am just frustrated. I may just call it a day and try the docker install.