So I deployed laravel app using lemp nginx droplet. It was working fine. I changed the project folder name from /var/www/html to /var/www/stand_blog and I ediied digitalocean file in /etc/nginx/sites-available so that the root points to /var/www/stand_blog/public. I restarted nginx using sudo systemctl restart nginx and it said time out error. I waited for around 15 minutes and tried again and it was restarted successfully. I checked sudo nginx -t and it says ok. But when I check the browser, I got view not found error. Is there anything I need to do? Thank you.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey!
It sounds like you’ve taken the correct steps by updating the Nginx configuration file to point to the new directory and restarting Nginx. However, the “View Not Found” error in a Laravel application typically indicates an issue with the Laravel view files not being found where the framework expects them to be.
This could be due to several reasons, including file permissions, Laravel cache, or Nginx configuration issues. Here are a few suggestions that you could check:
Check File Permissions: Ensure that the
/var/www/stand_blog
directory and its contents have the correct permissions. Laravel needs certain permissions to read files and directories.Replace
www-data:www-data
with the user and group Nginx runs as on your server if it’s different.Clear Laravel Cache: Sometimes, Laravel caches paths that might not update immediately after such changes. Clear the Laravel cache by running these commands from the root of your Laravel project (
/var/www/stand_blog
):Check Nginx Configuration: Double-check the Nginx configuration for any typos or mistakes, especially in the
root
directive. It should point to thepublic
directory of your Laravel application:Also, ensure that the
server_name
directive is correctly set to your domain or IP address.Check Laravel’s .env File: Ensure that the
.env
file in your Laravel project (/var/www/stand_blog/.env
) is correctly configured, especially theAPP_URL
setting, which should match your site’s URL.Check the Laravel Log: Check the Laravel log file located in
/var/www/stand_blog/storage/logs
for any specific errors that might point to the problem.Ensure Nginx is Running: After making changes, ensure that Nginx is running without errors:
If you encounter a timeout error again when trying to restart Nginx, investigate further by checking the Nginx error logs (
/var/log/nginx/error.log
) for any indications of what might be wrong.Let me know how it goes!
Best,
Bobby
The “view not found” error in Laravel usually indicates a problem with Laravel’s views or its cache. As suggested, the following should resolve the issue for you