Have you cached your routes ?
php artisan route:cache
I am working on Laravel 10 on top of Breeze with Livewire using full page components.
In my web.php I have routes:
/** only relevant code included **/
use App\Http\Livewire\Dashboard;
use App\Http\Livewire\Equipment;
use App\Http\Livewire\ManageUser;
use App\Http\Livewire\Searchanpr;
use App\Http\Livewire\Sitepage;
Route::middleware(['auth', 'verified'])->group(function(){
Route::get('/dashboard', Dashboard::class)->name('dashboard');
Route::get('/anprvehicle', Searchanpr::class)->name('anpr');
});
Route::middleware(['auth', 'verified', 'admin'])->group(function(){
Route::get('/equipment', Equipment::class)->name('equipment');
Route::get('/sitemgmt', Sitepage::class)->name('site');
Route::get('/usermgmt', ManageUser::class)->name('usermgmt');
});
When checking routes with php artisan route:list all the routes exist.
/** only relevant routes displayed **/
GET|HEAD anprvehicle ................................................... anpr › App\Http\Livewire\Searchanpr
GET|HEAD dashboard................................................... dashboard › App\Http\Livewire\Dashboard
GET|HEAD equipment ................................................... equipemnt › App\Http\Livewire\Equipment
GET|HEAD sitemgmt ................................................... site › App\Http\Livewire\Sitepage
GET|HEAD usermgmt ................................................... usermgmt › App\Http\Livewire\ManageUser
Locally, using WSL 2 with Docker all the routes load fine in sail. But on production, azure web server with linux, the site and anpr routes return 404 not found from nginx (not the laravel 404 not found).
This is my startup.sh
#!/bin/bash
cp /home/site/wwwroot/azure-app-service/nginx.conf /etc/nginx/sites-available/default && service nginx restart
echo "Copied Laravel Configuration File to nginx directory & restarted nginx"
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh |bash
echo "Installed NVM Node verison manager"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install node
echo "Installed node & npm"
npm install
echo "ran npm install"
npm run build
echo "ran npm build"
php artisan optimize:clear
echo "Cleared all cache and config files"
php artisan optimize
echo "optimized all cache and config files"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
mv composer.phar /usr/local/bin/composer
echo "Composer downloaded installed and made global"
php -r "unlink('composer-setup.php');"
composer install --optimize-autoloader --no-dev
echo "Composer's class autoloader map optimized"
I run dos2unix startup.sh, after it has been modified, before pushing to azure
The default nginx.conf did not work for me so I am using this nginx.conf
In production, I am able to login, access the dashboard, equipment and usermgmt but anprvehicle and sitemgmt can`t be accessed.
When I initially had dashboard, anprvehicle, equipment and sitemgmt I was not able to access just sitemgmt which I thought might be fixed when I push into the repo but now I cannot access both anprvehicle and sitemgmt
Please let me know If I am missing anything.
Have you cached your routes ?
php artisan route:cache
Please or to participate in this conversation.