F
Filamentβ€’3mo ago
yohanan

deploying laravel filament app on local machine issues

Hi, i'm about to deploy my app on local server, windows system with xampp. I've build the app for production and putted in the htdocs folder. What i've donne is: composer install --optimize-autoloader --no-dev And npm run build I can access login page with: http://localhost/my-app-name/public. Login page appear correctly but when i try to login, this error appear : Not found The request URL was not found on this server. As in the attached screenshots The errors in console also in joined screenshots. I don't realy know what happend,what cause that. Can i please have your assistance guys?
No description
No description
29 Replies
Tonkawuck
Tonkawuckβ€’3mo ago
Your webserver should be setting the entry point of your application as public/index.php. Right now it looks like your entry point is the application root (folder level with app, storage, routes folders) Actually no, it appears that your local environment entry point is htdocs, and your project folder is within. Your entry point should be set to htdocs/my-app-name/public/index.php
yohanan
yohananOPβ€’3mo ago
How can i change this and where. I tried to change the app_url in .env file to "http://localhost/my-app-name/public/" but not working.
David | Fortune Validator
Laravel Herd
Laravel Herd
Laravel Development perfected - One click PHP development environment.
yohanan
yohananOPβ€’3mo ago
I tried it, for an existing project. But it's not working. I juste placed the laravel filament project in herd directory. But when i open the project in brosser, the xampp dashboard is display on directory-name.test
David | Fortune Validator
Remove xamp. Maybe there is a port conflict
yohanan
yohananOPβ€’3mo ago
I'm using the free version, i'm not seeing any database in services. That's why i kept xampp activated.
ChesterS
ChesterSβ€’3mo ago
The free version only supports SQLite AFAIK. It should be enough for most use cases (especially if you're still learning)
toeknee
toekneeβ€’3mo ago
use DBNgin for databases
yohanan
yohananOPβ€’3mo ago
I'm about to deploy app in production on customer local machine. That's why i'm using MySQL.
ChesterS
ChesterSβ€’3mo ago
Yeap. Even so, you should be fine if you're not using any Mysql-spcific stuff. Anyway, I suggest you look into other local dev solutions. I haven't used the paid version of herd, maybe it's worth it for you. Or I suggest you look into docker. Either with sail or DDEV (https://ddev.com/)
DDEV
DDEV
Local development environments in seconds. Customize, share, and extend with ease.
~Mauricio
~Mauricioβ€’3mo ago
For Windows, there is Laragon as well, worth a try since you 'xampping' already...https://laragon.org/download/
Laragon - portable, isolated, fast & powerful universal development environment for PHP, Node.js, Python, Java, Go, Ruby.
Download
Laragon is a universal development environment. It has many features to make you more productive:Benefits of Laragon After downloading, You can add git, phpmyadmin, Node.js/MongoDB, Python/Django/Fla
yohanan
yohananOPβ€’3mo ago
Trying this one, but after ddev config, it show me "successfully started name-of-project" and project Can be reached at: links But links not work. Finaly, i retried this one. First uninstlled xampp like suggested @David | Fortune Validator . Installed DBNgin like @toeknee said. Unzipped my project in a directory and linked existing project in Herd. After deleted thΓ© config file in bootstrap folder, every thing worked fine. Except filament PWA not working and public_path for image in domPDF. Thanks everyone for your precious help. Now, what if i want to configure cron jobs, is there a way? I precise i'm on windows environment and using Herd and DBNgin.
~Mauricio
~Mauricioβ€’3mo ago
since you must have to use a windows machine, what about just installing WSL? or a simple VM running Linux?? get a penguin 🐧 virtualization under windows and be happy my friend πŸ˜„
yohanan
yohananOPβ€’3mo ago
πŸ™ƒ seem to be easy. But do you have any guide for that? Or any tutorial ?
Dennis Koch
Dennis Kochβ€’3mo ago
There should be numerous WSL guides out there on the web.
yohanan
yohananOPβ€’3mo ago
Tried first to deploy on linux in /www/html. Same issue occured as before on windows. "Not found The request URL was not found on this server." I suppose this will cause the same error using WSL on windows. Can you try to deploy in production a laravel or filament project and see if you will be facing to the same errors ?
Dennis Koch
Dennis Kochβ€’3mo ago
Tried first to deploy on linux in /www/html
The document root should be set to the public folder for every Laravel project So if you code is in /www/html the document root of the configured server/domain should point to /www/html/public
yohanan
yohananOPβ€’3mo ago
Where to change this?
~Mauricio
~Mauricioβ€’3mo ago
All right, how are you serving the app? which tool from those above that everyone mentioned you decided to use? you will have to configure that serving tool to serve from the ./public folder and not the root folder as previously mentioned. Maybe then we can help ya. You said "tried first to deploy on linux in /www/html" , but how did you do it? Gives us detail about your setup and we may guide ya in the proper direction.
yohanan
yohananOPβ€’3mo ago
Testing for linux First, i prepared the app for production. Second, copied the project in /var/www/html directory. Then tried to open the app using : http://localhost/project-name/public Login page appeared properly, but when i try to login, the error occured. That's what i've done.
~Mauricio
~Mauricioβ€’3mo ago
I am no sure you mean by "prepared the app for production'", does that mean you built the assets (npm run build)? could you explain with some more details? that would help πŸ™‚ it would be better. what is the web server software you are using to serve the app in "production'? Xampp? Herd? Artisan serve? Docker? It is in the web serving software that you will configure the location to serve the app as mentioned before. Please, detail your current setup
yohanan
yohananOPβ€’3mo ago
Ubuntu 20.04 PHP 8.2 Apache 2.4 Laravel 10 Filament 3.1 Preparing project for production Composer install --optimize-autoloader --no-dev And npm run build I'm my unswered your question ?
~Mauricio
~Mauricioβ€’3mo ago
Great you are using apache you need to just change its config for virtualhosts
yohanan
yohananOPβ€’3mo ago
For windows,i used Herd free version. It working. But don't know how to configure cron jobs.
~Mauricio
~Mauricioβ€’3mo ago
usually you dont have to setup cron jobs, (in windows we have task scheduler) , with laravel you should keep a running instance of php artisan schedule:work for scheduled tasks and a queue work to run async tasks so if in windows , herd is running ok, then all you need to do is open a terminal and keep those command running i guess you could use Task Scheduler and set up to run an artisan command now, in the linux world, you do have cron, but usually , even in the docs, we suggest to use a tool called supervisor so it keeps running the 'php artisan schedule:work' and queue
yohanan
yohananOPβ€’3mo ago
Yes, but this means customer have to execute those command himself every time the computer restarted ? I mean on windows
~Mauricio
~Mauricioβ€’3mo ago
thats easy to solve, you can script the command in a simple BAT/CMD file and add into you task scheduler/startup folder/run in registry my friend πŸ˜„ ChatGPT: Step 1: Create a Batch File Open Notepad or any text editor. Paste the following code into the file: @echo off cd C:\xampp\htdocs\your-laravel-app php artisan queue:work Replace C:\xampp\htdocs\your-laravel-app with the path to your Laravel application directory. Save the file with a .bat extension, for example, start_queue_worker.bat. Make sure to save it somewhere that will not be moved or deleted, like C:\Scripts. Step 2: Set Up Task Scheduler Open Task Scheduler: Press Win + R, type taskschd.msc, and press Enter. Create a New Task: Click Action > Create Task. General Tab: Name: Enter a name for the task, e.g., Laravel Queue Worker. Security Options: Choose Run whether user is logged on or not and check Run with highest privileges. Triggers Tab: Click New… to create a new trigger. Begin the task: Choose At startup. Click OK. Actions Tab: Click New… to create a new action. Action: Select Start a program. Program/script: Browse and select the .bat file you created (e.g., C:\Scripts\start_queue_worker.bat). Click OK. Conditions Tab: Uncheck Start the task only if the computer is on AC power to make sure it runs even if the PC is not plugged in. Settings Tab: Make sure Allow task to be run on demand is checked. You can also check If the task fails, restart every to automatically restart the task if it fails, and set it to 1 minute for a maximum of 3 attempts. Click OK to save the task. You can even set ut up so the console/terminal doesnt show on the machine, it just runs on the background so if you got Herd working, then just need to get those bat files running the artisan commands for you. In the example above it shows setting for the Queue Work, just change it to fit your needs if all you need it the Scheduler Worker Hopefully that helps my friend!
yohanan
yohananOPβ€’3mo ago
Yes my freind, this is very helpfull. I think it will be ok now. Gonna try this solution. Thanks you so much for your help. Facing another issue. I've to allow the others machine to access the app. So app is installed on a machine as server, and others machine have to access it on local network. I tried to edit the nginx configuration file for the app to set listen 127.0.0.1:80 to listen 80 as explaned in laravel docs. But not working.
~Mauricio
~Mauricioβ€’3mo ago
If you got it working on the local /client machine, you just need to do some basic networking my friend. I would setup the app serving machine with a static IP wihtin your intranet, and configure its firewall to allow the web service to be accessed by others on the same network, so that people can use http://<machine-ip> to access it..
Want results from more Discord servers?
Add your server