It sounds like you're facing a common issue when deploying a Laravel application to a new server environment. Here are some steps to troubleshoot the problem:
-
Check Server Requirements: Ensure that the new server meets the system requirements for Laravel 10, which includes PHP 8.0 or higher. You can check the PHP version by running
php -vin the terminal. -
Configure Environment Variables: Make sure that the
.envfile on the new server has the correct settings for your application, includingAPP_URL, database credentials, and any other necessary configuration. -
Check Web Server Configuration: Verify that your web server (Nginx or Apache) is configured correctly to serve your Laravel application. The document root should point to the
publicdirectory of your Laravel application. -
File Permissions: Ensure that the storage and bootstrap/cache directories are writable by the web server. You can set the correct permissions using the following commands:
sudo chown -R www-data:www-data storage bootstrap/cache sudo chmod -R 775 storage bootstrap/cache -
Clear Caches: Since you've migrated the database and deployed the application, clear all caches to ensure that the application is not using any stale configuration. Run the following artisan commands:
php artisan config:clear php artisan cache:clear php artisan route:clear php artisan view:clear -
Check Logs: Look at the Laravel log file in
storage/logs/laravel.logfor any application-specific errors. Also, check the web server's error logs for any server-level issues. -
SSL Configuration: If your application is supposed to run under HTTPS, browsers may refuse to connect if the SSL certificate is not set up correctly. Since you mentioned SSL is not set up yet, you can temporarily test the application using HTTP, but remember to configure SSL before going to production.
-
DNS and Hosts File: Since you haven't pointed your domain to the new server yet, you can modify your local
hostsfile to point the domain to the new server's IP address for testing purposes. This will allow you to access the application in the browser as if the domain was already pointed to the new server. Remember to remove this entry after testing.On Windows, the
hostsfile is usually located atC:\Windows\System32\drivers\etc\hosts. On Linux and macOS, it's at/etc/hosts. Add a line like this:new.server.ip.address subdomain.domain.org -
Firewall and Ports: Ensure that the firewall on your new server is not blocking HTTP/HTTPS traffic. Also, make sure that the web server is listening on the correct ports (80 for HTTP and 443 for HTTPS).
After going through these steps, try accessing your application again. If you still encounter issues, the error messages from the logs or any new symptoms should help you narrow down the problem further.