Recentemente decidi testar os conhecimentos adquiridos no curso aplicando a LP que estou acostumado a usar ( PHP ) então criei um container com php, mysql e o nginx para rodar uma aplicação de testes no laravel. Quando eu rodo o localhost:8080 ele entra na tela inicial, porém quando eu acesso o localhost:8080/qualquer-coisa ele me devolve um 500 Internal Server Error nginx Meu Dockerfile:
FROM wyveo/nginx-php-fpm:latest
WORKDIR /usr/share/nginx/
RUN ln -s public html
Meu docker-compose:
version: '3'
services:
laravel-app:
build: .
ports:
- "8080:80"
volumes:
- ./:/usr/share/nginx
networks:
- app-network
depends_on:
- mysql-app
mysql-app:
image: mysql:5.7.22
ports:
- "3306:3306"
volumes:
- .docker/dbdata:/var/lib/mysql
environment:
MYSQL_DATABASE: laravel
MYSQL_ROOT_PASSWORD: laravel
networks:
- app-network
networks:
app-network:
driver: bridge
Meu .env do Laravel:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:J1To8j9HI/aTHM2b/rLlMzJc6aXMVcKlO0wuu9ziG7E=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql-app
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=laravel
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Meu arquivo de rotas:
<?php
use App\Http\Controllers\ContatoController;
use App\Models\Contato;
use App\Models\User;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
$contatos = Contato::all();
return view('index', compact('contatos'));
});
Route::get('/contato', [ContatoController::class, 'index']);