Problems with Laravel 5.2 routes and AWS EC2 server

Asked

Viewed 58 times

0

I’m having trouble getting my project up to hosting, when access to the service via localhost everything works perfectly, but when I upload my project to the server it presents the error:

Imagem do erro

My Routes.php route file looks like this:

<?php

Route::singularResourceParameters();

Route::auth();

/// METODOS DELETE

Route::post('/produtos/delete', [
    'uses' => 'ProdutoController@delete',
    'as' => 'produtos.delete'
]);

Route::post('/imagens/delete', [
    'uses' => 'ImagemController@delete',
    'as' => 'imagens.delete'
]);

Route::post('/categorias/delete', [
    'uses' => 'CategoriaController@delete',
    'as' => 'categorias.delete'
]);

Route::post('/subcategorias/delete', [
    'uses' => 'SubCategoriaController@delete',
    'as' => 'subcategorias.delete'
]);

Route::post('/embalagens/delete', [
    'uses' => 'EmbalagemController@delete',
    'as' => 'embalagens.delete'
]);

Route::post('/tipo_produtos/delete', [
    'uses' => 'TipoProdutoController@delete',
    'as' => 'tipo_produtos.delete'
]);


///

Route::group(['middleware' => ['cors']], function (){
    Route::resource('clientes', 'ClienteController');
    Route::resource('categorias', 'CategoriaController');
    Route::resource('embalagens', 'EmbalagemController');
    Route::resource('tipo_produtos', 'TipoProdutoController');
    Route::resource('subcategorias', 'SubCategoriaController');
    Route::resource('produtos', 'ProdutoController');
    Route::resource('loteproduto', 'LoteProdutoController');
});

Route::get('/clientes/encomenda/{id}', [
    'uses' => 'ClienteController@encomenda',
    'as' => 'dashboard.index'
]);

///ROTA DASHBOARD

Route::get('/', [
    'uses' => 'DashboardController@index',
    'as' => 'dashboard.index'
]);

Route::get('/produzir', [
    'uses' => 'DashboardController@produzir',
    'as' => 'dashboard.produzir'
]);

Route::get('/entregar', [
    'uses' => 'DashboardController@entregar',
    'as' => 'dashboard.entregar'
]);
///FIM ROTA DASHBOARD

///ROTA PEDIDOS

Route::get('/pedidos/pendentes', [
    'uses' => 'PedidoController@pendentes',
    'as' => 'pedidos.pendentes'
]);

Route::get('/pedidos/entrega', [
    'uses' => 'PedidoController@entrega',
    'as' => 'pedidos.entrega'
]);

Route::get('/pedidos/todos', [
    'uses' => 'PedidoController@todos',
    'as' => 'pedidos.todos'
]);

Route::get('/pedidos/cancelados', [
    'uses' => 'PedidoController@cancelados',
    'as' => 'pedidos.cancelados'
]);

Route::get('/pedidos/concluidos', [
    'uses' => 'PedidoController@concluidos',
    'as' => 'pedidos.concluidos'
]);

Route::get('/pedidos/produzindo', [
    'uses' => 'PedidoController@produzindo',
    'as' => 'pedidos.produzindo'
]);

Route::get('/pedidos/{id}', [
    'uses' => 'PedidoController@show',
    'as' => 'pedidos.show'
]);

Route::post('/pedidos', [
    'uses' => 'PedidoController@mudarStatus',
    'as' => 'pedidos.mudar'
]);

Route::get('/pedidos/efetivar/{id}', [
    'uses' => 'PedidoController@efetivar',
    'as' => 'pedidos.efetivar'
]);
///FIM ROTA PEDIDOS


Route::get('/parametros', [
    'uses' => 'ParametrosController@index',
    'as' => 'parametros.efetivar'
]);

Route::PATCH('/parametros', [
    'uses' => 'ParametrosController@editar',
    'as' => 'parametros.editar'
]);

Route::get('/login', function (){
    return view('auth.login');
});

///ROTA IMAGENS

Route::get('/imagens/{id}', [
    'uses' => 'ImagemController@mostrar',
    'as' => 'imagens.index'
]);


Route::get('/imagens/create/{id}', [
    'uses' => 'ImagemController@create',
    'as' => 'imagens.create'
]);

Route::post('/imagens/store', [
    'uses' => 'ImagemController@store',
    'as' => 'imagens.store'
]);

Route::get('/imagens/mostrar/{id?}', [
    'uses' => 'ImagemController@show',
    'as' => 'imagens.show'
]);

///FIM ROTA IMAGENS

///ROTA LOTE
Route::get('/lotes/imprimir/{id}', [
    'uses' => 'LoteProdutoController@print',
    'as' => 'lotes.print'
]);

Route::get('/lotes/{id}', [
    'uses' => 'LoteProdutoController@mostrar',
    'as' => 'lotes.index'
]);

Route::get('/lotes/create/{id}', [
    'uses' => 'LoteProdutoController@create',
    'as' => 'lotes.create'
]);

Route::post('/lotes/store', [
    'uses' => 'LoteProdutoController@store',
    'as' => 'lotes.store'
]);

///FIM ROTA LOTE

///ROTA RELATORIO
Route::get('/relatorio/pedidos', [
    'uses' => 'RelatorioController@pedidos',
    'as' => 'relatorio.pedidos'
]);

Route::post('/relatorio/pedidos', [
    'uses' => 'RelatorioController@Postpedidos',
    'as' => 'relatorio.Postpedidos'
]);

Route::get('/relatorio/compras', [
    'uses' => 'RelatorioController@compras',
    'as' => 'relatorio.compras'
]);

Route::get('/relatorio/entregas', [
    'uses' => 'RelatorioController@entregas',
    'as' => 'relatorio.entregas'
]);

Route::get('/relatorio/clientes', [
    'uses' => 'RelatorioController@clientes',
    'as' => 'relatorio.clientes'
]);

Route::post('/relatorio/clientes', [
    'uses' => 'RelatorioController@Postclientes',
    'as' => 'relatorio.Postclientes'
]);
///FIM ROTA RELATORIO

I once saw an issue that would have to change something in minahs routes because the problem was in the group, but could not identify where I saw the error. I don’t really know if this is it.

In my attempt to solve the problem, as I have full control of the server I made the changes making my documentRoot go straight to public folder, this did not solve my problem, continued the same. The commands I used are:

sudo nano /etc/apache2/sites-available/000-default.conf sudo nano /etc/apache2/apache2.conf sudo service apache2 Restart

  • @Guilhermenascimento is not duplicate because I tried to solve it that way and weighed the error. If you Let my whole question you will see that I am finding that it is problems in the routes

  • Access only http://localhost/ does it work? Note that my answer explains more than one way of doing and by your image you are using /plubic

  • There’s no way to access localhost, because it’s a dedicated AWS (Amazon Web Service) server that’s more accurate than EC2

  • Okay, but in what way you set up Laravel on it, it was by DocumentRoot and the Directory Apache or by . htaccess or moved the contents of public to root (where the files are, such as /var/www)?

  • I did the updates of documentRoot Apache2, the others did not understand very well how should do 3r

  • The default of Apache2, is the folder /var/www/html/{Here comes my files including the public folder of Laravel} the only thing I did was change the path instead of the /var/www/html to /var/www/html/public, to go straight to page, and worked, but continued with the same error of 404 NOT FOUND

  • Join the chat to continue please

  • @Renanrodrigues has how to configure to the folder public?

  • @Virgilionovic I’ve done this, today it’s set to go straight to public folder

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.