Question

I deployed laravel 10 project with git and it shows me apache2 default page

I use digitalOcean’s trial versions with credits and don’t have a domain. I searched and saw for this you can change sites-avalable config files but now it return http 500 error # This site can’t be reached. How can I change default page?


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.

Bobby Iliev
Site Moderator
Site Moderator badge
March 6, 2024

Hey,

The Apache2 default page usually appears when the Apache server is up and running, but it’s not configured to serve your Laravel application. Since you’ve already attempted to modify the sites-available configuration and are now facing an HTTP 500 error, it’s likely there’s a misconfiguration or an issue with your Laravel app’s settings.

  1. Ensure that your virtual host configuration in /etc/apache2/sites-available/your-laravel.conf is correctly set up to point to your Laravel project’s public directory. It should look something like this:
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/your-laravel-project/public

    <Directory /var/www/your-laravel-project/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Remember to replace /var/www/your-laravel-project/public with the actual path to your project’s public directory.

  1. If you haven’t already, enable your site configuration using a2ensite your-laravel.conf and then reload Apache with systemctl reload apache2.

  2. Ensure that the .htaccess file in your Laravel project’s public directory is correctly configured and present. Laravel’s default .htaccess is usually sufficient, but it’s crucial it’s not accidentally modified or missing.

  3. This error indicates a server-side issue, often related to your Laravel application’s code or environment settings. Check the Laravel log files in storage/logs/ for any specific error messages that could guide you to the root cause. Additionally, you can check the Apache error logs typically found in /var/log/apache2/error.log.

  4. Confirm that all dependencies are correctly installed with composer install, and the necessary permissions are set for the storage and bootstrap/cache directories.

If after these steps you’re still encountering issues, feel free to share the error messages you’re seeing in the logs, and I’d be happy to help further diagnose the problem.

Alternatively, I could suggest using Nginx instead of Apache. There is also a 1-click installation for Laravel available here which uses Nginx:

https://marketplace.digitalocean.com/apps/laravel

Best,

Bobby

Try DigitalOcean for free

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

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more