Display laravel project in vps (apache)?

1

I'm trying to upload my laravel project to a vps, obviously you think I'm an imbecile asking how to configure apache to deploy the app, but I get HTTP_ERROR 500 and I can not think of anything else to do, I have to say that I have previously managed to deploy another project in this same hosting.

I bought a vuntu from ubuntu 14.04 clean, I installed LAMP and I configured apache in sites-available, to generate a file.conf.

The strange thing is that even if you disable the sites-available / 000-default, copying the file and changing the path for the laravel project (just installed in / var / www / proyecto / public) there is no way to take the configuration

I have activated the rewrite module and put the host name in / etc / hosts

and it still does not work.

Any suggestions please? Edit: I have copied the configuration of my apache configuration file from another server where I have deployed a laravel project, and I have even uploaded that project to this vps, and I have not gotten it to work, I have even reinstalled everything from 0, I paste the content of the apache configuration file:

<VirtualHost *:80>

    ServerName vps585365.ovh.net

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/api/public

    <Directory /var/www/api/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
     </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

     <IfModule mod_dir.c>
        DirectoryIndex index.php index.pl index.cgi index.html index.xhtml $
    </IfModule>

Somebody could summarize me what files of apache or laravel you have to touch or modify so that everything works correctly, because I think I'm forgetting something ...

Is there a difference between debian and ubuntu? With respect to the apache configuration on the server. Edit2: index.php of my project:

<?php

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

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

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

laravel.log:

    [2018-09-24 15:06:52] production.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "composer" is not defined. in /var/www/apigranja/vendor/symfony/console/Application.php:515
Stack trace:
#0 /var/www/apigranja/vendor/symfony/console/Application.php(183): Symfony\Component\Console\Application->find('composer')
#1 /var/www/apigranja/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output$
#2 /var/www/apigranja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Sym$
#3 /var/www/apigranja/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}

Thank you very much in advance.

Greetings.

    
asked by Peisou 20.09.2018 в 13:53
source

1 answer

1

It was composer's fault, in Apache the configuration was perfect. For starters, I had the wrong .env file with which I did not save the log records and I did not know what was wrong:

APP_LOG_LEVEL=debug !!!!!!!!

Thanks to that I managed to discover that the composer was failing with which I try to install it and we arrived at the following failure; I needed php 7.2 with which install the necessary dependencies:

apt-get -y install unzip zip nginx php7.2 php7.2-mysql php7.2-fpm php7.2-mbstring php7.2-xml php7.2-curl

To continue reinstall all composer globally following these commands:

apt update && apt upgrade
apt install php-mcrypt php-gd php-mbstring hhvm phpunit
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer

We create or clone a project:

git clone https://github.com/laravel/laravel.git

We install composer if it is cloned: composer install

We give permissions: chown www-data: -R * && chown www-data: -R .*

We generate the key and rename the .env:

mv .env.example .env
php artisan key:generate

We copy the key in config / app.php

'key' => env('APP_KEY', 
'base64:7fO0S9TxZu8M2NwBWVEQsjPGRi+D1t6Ws8i0Y2yW/vE='),
'cipher' => 'AES-256-CBC',

And already having a clear idea how to use the Apache virtual host should show the page,

    
answered by 25.09.2018 / 09:48
source