Question

Error 503 Service not found

My apps keep displaying the 503 Service Not Found page. I tried restarting a few times but no luck. I checked the error logs in /var/log/apache2/error.log but could not find anything. Please help I got stuck.

OS: Ubuntu Framework: Laravel


Submit an answer


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!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
September 26, 2024

Heya, @stalinks

A common cause of 503 errors is the server running out of resources, this includes disk space, CPU and memory. You can use tools like top, htop, df -h, free -m

You can also check this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-monitor-cpu-use-on-digitalocean-droplets

Regards

Hey there! 👋

A 503 Service Not Found error typically indicates that your server is temporarily unable to handle the request. This can happen for several reasons, such as your web server being overloaded, your application being down, or a misconfiguration in your server setup.

Here are a few things that you can check as per this guide here

  1. Check Apache Service Status: Since you’re using Apache, the first thing to do is to make sure Apache is running properly. You can check the status with:

    sudo systemctl status apache2
    

    If Apache isn’t running, try restarting it:

    sudo systemctl restart apache2
    
  2. Check Apache Configuration: There might be an issue with the Apache configuration. You can test the configuration to see if there are any syntax errors:

    sudo apachectl configtest
    

    If there are any errors, the output will provide clues on what needs to be fixed.

  3. Check Laravel Application Logs: If Apache is running fine, the issue might be with your Laravel application itself. Check the Laravel logs located in storage/logs/laravel.log:

    tail -f /path-to-your-laravel-app/storage/logs/laravel.log
    

    This might give you more information on what’s going wrong within the application.

  4. Check File and Folder Permissions: Sometimes, permission issues can cause a 503 error. Ensure that the files and folders in your Laravel application have the correct permissions:

    sudo chown -R www-data:www-data /path-to-your-laravel-app
    sudo chmod -R 755 /path-to-your-laravel-app/storage
    sudo chmod -R 755 /path-to-your-laravel-app/bootstrap/cache
    
  5. Verify Database Connection: If your Laravel app depends on a database, make sure the database is up and running, and that Laravel can connect to it. Check your .env file for the correct database credentials.

If you’re looking for a quicker and more straightforward setup, you might want to consider using the Laravel 1-Click App from the DigitalOcean Marketplace. It’s a pre-configured image that sets up a new Laravel environment on a Droplet with minimal hassle. However it uses Nginx rather than Apache which is the recomended way of deploying Laravel as per their official documentaton.

Here’s a guide on how to use the Laravel 1-Click App. It walks you through the entire setup process, which might help you avoid these issues in the future.

Good luck, and I hope your app is back up and running soon! 🚀

- Bobby

KFSys
Site Moderator
Site Moderator badge
September 17, 2024

Heya,

If you’re seeing 503 Service Unavailable errors, this means PHP processes are crashing while executing a script. As a result, Apache is not getting a valid response from PHP

Check your Laravel’s Application log rather than the Apache log. In there you’ll see the exact error and can further act upon it.

If you want you can post it here as well so we can further try and assist.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.