Problem:I can't access all file in public folder, but when i'm in index.php there is no problem.
Image may be NSFW.
Clik here to view.Image may be NSFW.
Clik here to view.Image may be NSFW.
Clik here to view.
I've just provide my index.php screenshot, there is some asset(image,css,js) that's not loaded, when i inspect element, i get 404 error. Same result when, i'm manually write url in browser, I've already checked in server, the file is exists.
This problem only happens in live server, when in development environment this problem isn't happening. All file is same, cause i'm just cloning it from local to my live server
Server and project description:
- Ubuntu 22
- PHP 8
- Node JS 18
- NPM 10
- I'm using laravel 11
Some parts on my .env in live server:
APP_NAME="Everbright Web Integrated"APP_ENV=productionAPP_KEY=base64:xxxAPP_DEBUG=falseAPP_TIMEZONE=UTCAPP_URL=https://192.168.8.210:443
Things already do:
- php artisan storage:link -> result fail
- set permission in public folder to 777 -> result fail
- manually check file is exists -> result fail
- change env to productionn -> result fail
I'm expecting there is no 404 error when access file in public folder
Apache directives in /etc/apache2/sites-available/xxx.conf that apply to this virtual server
DocumentRoot /home/public_html/ewi/publicServerAdmin xxxSSLEngine onSSLCertificateFile /etc/apache2/xxxSSLCertificateKeyFile /etc/apache2/xxx<Directory /home/public_html/ewi> Options Indexes FollowSymLinks AllowOverride All Require all granted</Directory><IfModule mod_rewrite.c><IfModule mod_negotiation.c> Options -MultiViews -Indexes</IfModule> RewriteEngine On # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]</IfModule>ErrorLog ${APACHE_LOG_DIR}/demo-error.logCustomLog ${APACHE_LOG_DIR}/demo-access.log combined
Image may be NSFW.
Clik here to view.
Here my routes file :
<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
if (Auth::check()) {
return view('home', ['kdSupp' => Auth::user()->kdsupp]);
} else {
return view('welcome');
}
});
Auth::routes();
Route::get('/list-supp', [App\Http\Controllers\WebRequestController::class, 'listSupplier']);
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
// Surat Jalan
Route::get('/surat-jalan/upload', [App\Http\Controllers\SuratJalanController::class, 'index']);
Route::get('/surat-jalan/view', [App\Http\Controllers\SuratJalanController::class, 'lihatSuratJalan']);
Route::get('/surat-jalan/detail/{id}', [App\Http\Controllers\SuratJalanController::class, 'lihatDetailSuratJalan']);
Route::post('/surat-jalan/upload', [App\Http\Controllers\SuratJalanController::class, 'importExcel']);
Route::patch('/surat-jalan/ubah', [App\Http\Controllers\SuratJalanController::class, 'ubahSuratJalan']);
Route::patch('/surat-jalan/ubah-item', [App\Http\Controllers\SuratJalanController::class, 'ubahItemSuratJalan']);
Route::delete('/surat-jalan/hapus', [App\Http\Controllers\SuratJalanController::class, 'hapusSuratJalan']);
Route::delete('/surat-jalan/hapus-item', [App\Http\Controllers\SuratJalanController::class, 'hapusItemSuratJalan']);
// End Surat Jalan
//Invoice
Route::get('/invoice/upload', [App\Http\Controllers\InvoiceController::class, 'index']);
Route::get('/invoice/view', [App\Http\Controllers\InvoiceController::class, 'lihatInvoice']);
Route::get('/invoice/detail/{id}', [App\Http\Controllers\InvoiceController::class, 'lihatDetailInvoice']);
Route::post('/invoice/upload', [App\Http\Controllers\InvoiceController::class, 'importExcel']);
Route::patch('/invoice/ubah', [App\Http\Controllers\InvoiceController::class, 'ubahInvoice']);
Route::patch('/invoice/ubah-harga', [App\Http\Controllers\InvoiceController::class, 'ubahHarga']);
Route::delete('/invoice/hapus', [App\Http\Controllers\InvoiceController::class, 'hapusInvoice']);
Route::delete('/invoice/hapus-sj', [App\Http\Controllers\InvoiceController::class, 'hapusSuratJalan']);
//End Invoice//Faktur Pajak
Route::get('/faktur-pajak/upload', [App\Http\Controllers\FakturPajakController::class, 'index']);
Route::get('/faktur-pajak/view', [App\Http\Controllers\FakturPajakController::class, 'lihatFakturPajak']);
Route::get('/faktur-pajak/detail/{id}', [App\Http\Controllers\FakturPajakController::class, 'lihatDetailFakturPajak']);
Route::post('/faktur-pajak/upload', [App\Http\Controllers\FakturPajakController::class, 'importExcel']);
Route::patch('/faktur-pajak/ubah', [App\Http\Controllers\FakturPajakController::class, 'ubahFP']);
Route::patch('/faktur-pajak/ubah-invoice', [App\Http\Controllers\FakturPajakController::class, 'ubahInvoice']);
Route::delete('/faktur-pajak/hapus', [App\Http\Controllers\FakturPajakController::class, 'hapusFP']);
Route::delete('/faktur-pajak/hapus-invoice', [App\Http\Controllers\FakturPajakController::class, 'hapusInvoice']);
//End Faktur Pajak
Route::post('/upload-excel', [App\Http\Controllers\UploadController::class, 'prosesUpload']);
// Download Route
Route::get('download/template/{filename}', function ($filename) {
// Check if file exists in app/storage/file folder
$file_path = storage_path() . '/file/' . $filename;
if (file_exists($file_path)) {
// Send Download
return Response::download($file_path, $filename, [
'Content-Length: ' . filesize($file_path)
]);
} else {
// Error
exit('Requested file does not exist on our server!');
}
})
->where('filename', '[A-Za-z0-9\-\_\.]+');