2

For the last month I coded a laravel project on local, using Laragon to have a local server. Now I want to deploy it online, using an ovh hosting ( required by a client ). So I have my ovh hosting, with the "perso" offer. I used the ftp credentials given by ovh, with FileZilla, and it worked. It gave me something like this : enter image description here

Then I uploaded all my project in the www folder. Now, when go to the domain, it doesn't display the front page but rather the folder itself, aka this : enter image description here

For now, I didn't touch the .env file. I deleted the default index.html in the www folder, I know the problem probably come from this. I searched everywhere and found not clear explanation. My knowledge on web hosting is limited, so I'm struggling with this. I know I missed something. Anyone who could help me, would save my life. Thank you !

3 Answers3

3

do not put you project files in the www folder, instead put them in a folder outside that directory 'called laravel for example'.

then copy or move the contents of the 'public' directory to 'www'. (www dir will now contain index.php,...).

edit the two lines in www/index.php that require autoload.php and app.php to reflect the new directory changes:

require __DIR__.'/../vendor/autoload.php';

should be:

require __DIR__.'/../laravel/vendor/autoload.php';

and

$app = require_once __DIR__.'/../bootstrap/app.php';

should be:

$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
Rabah
  • 2,052
  • 2
  • 16
  • 20
2

The best is to create a new folder in the /www folder with the name of your project.

For exemple: /www/laravel-project

Then you will need to go OVH admin panel, click on your domain and change the folder it is going to by /www/laravel-project/public

You need to go to the public folder of your Laravel project.

David
  • 155
  • 6
0

saying that your project name is : Laraval_project :

  1. using "filezilla", put 'laravel_project/' under the directory 'www/'.

  2. find the dir named : 'public/' under 'laravel_project/' and copie/pass it in the the parent dir, wich is : 'www/'.

  3. now u have side by side 'laravel_project/' and 'public/' under 'www/'.

  4. in 'public/' folder u'll find four files -> move them all to the parent dir, wich is 'www/'..

  5. edit www/index.php file as Rabah said :

    edit the two lines in www/index.php that require autoload.php and app.php to reflect the new directory changes:

require __DIR__.'/../vendor/autoload.php';

should be:

require __DIR__.'/laravel_projec/vendor/autoload.php';

and

$app = require_once __DIR__.'/../bootstrap/app.php';

should be:

$app = require_once __DIR__.'/laravel_project/bootstrap/app.php';

  1. if ther is a file named : 'www/index.html', rename it : 'index.html.old . enjoy
nmoumene
  • 15
  • 7