I have created a droplet and installed Laravel on it as well as services that are needed for Laravel such as Apache. I can ping my droplet but receive “This site can’t be reached” when attempting to access my website through a web browser.
How can I access my Laravel app via a web browser?
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.
Hi @curtiscolly,
You’ll need to create an Apache configuration file for your domain name. In order for Apache to serve your Laravel App’ content, it’s necessary to create a virtual host file with the correct directives. Instead of modifying the default configuration file located at /etc/apache2/sites-available/000-default.conf directly, let’s make a new one at /etc/apache2/sites-available/your_domain.conf:
Paste in the following configuration block, which is similar to the default, but updated for our new directory and domain name:
Notice that you need to update the DocumentRoot to your directory and ServerAdmin to an email that the your_domain site administrator can access. There are also two very important directives: ServerName, which establishes the base domain that should match for this virtual host definition, and ServerAlias, which defines further names that should match as if they were the base name.
Save and close the file when you are finished.
Let’s enable the file with the a2ensite tool:
Disable the default site defined in 000-default.conf:
Next, let’s test for configuration errors:
You should see the following output:
Restart Apache to implement your changes:
Regards, KFSys