phplaravel.env

Application error after changing from APP_ENV=local to APP_ENV=production in .env Laravel


So I wanted to deploy my app to production, and I changed from:

APP_ENV=local
APP_DEBUG=true

to

APP_ENV=production
APP_DEBUG=false

However, the API that I had created and its route immediately couldn't be accessed, aka an error. How could this happen? Are there any further changes that need to be made?

Because previously I could access my route fine when APP_ENV was still set to local from this address http://myweb.com/project-folder/public/api/test, like this:

Route::get('/test', function () {
    return 'Hello there!';
});

But not after I changed it to production. :(

I've run php artisan env to confirm the code changes, and also run php artisan config:clear, but still after the change, my code can't be accessed..

Please help, thank you


Solution

  • There may be a problem with your web server settings. Please check the directory path in nginx or apache . The default path should be the path to your index file

    If you are from local or using a shared host, please check the .htacess file .

    If the problem is not solved, check this in .env file . they

    APP_URL=http://myweb.com 
    APP_BASE_PATH=/var/www/myweb.com/public_html