0

I have finished my beautiful Laravel app let's call it Beautiful on my development PC. So its now time to put in a productive environment.

We're using Apache, and I've been told that my app must be under /var/apache/html/projects/Beautiful, so I transferred the app (using Git), ran composer and npm, and such. I already changed the .env file so it connects to the production postgres database and such.

Even the index page is working in http:://ourserver/Beautiful/public and here it comes my problem.

What else do I have to configure in order that it runs without the /public? The problem is that obviously all routes doesn't work with public, for example http://ourserver/Beautiful/public/login doesn't work, or any other.

Is it a thing of Apache's configuration, or there's something in Laravel I can do?

I know the correct thing to do would be to create a virtual host in Apache that points to Beautiful.ourserver.com, but I have no control on the DNS, all I can do is work from ourserver.

luisfer
  • 1,927
  • 7
  • 40
  • 54

1 Answers1

1

If I understand the problem correctly, you should follow the path below. put everything in the public folder into /var/apache/html/projects/Beautiful, then put all laravel folders and files into /var/apache/html/{somewhere}. Now edit /var/apache/html/projects/Beautiful/index.php and edit like this,
- require __DIR__.'/../vendor/autoload.php'; to require __DIR__.'/../{somewhere}/vendor/autoload.php';
- $app = require_once __DIR__.'/../bootstrap/app.php'; to $app = require_once __DIR__.'/../{somewhere}/bootstrap/app.php';';
and add below after this $app = require_once __DIR__.'/../{somewhere}/bootstrap/app.php';'; - $app->bind('path.public', function() { return __DIR__; });

TechnoBeceT
  • 42
  • 13
  • Yeah after banging my head all morning I found an article that described this, as usual, I was doing some other things at the time, so looks like one problem hidden another. Thank you very much. The article I'm talking about is: https://laravel-news.com/subfolder-install – luisfer May 19 '19 at 13:50