Question

Deploying a Laravel Project in a LAMP Ubuntu 20.4 Droplet. error 404 when trying to access with my domain

Good afternoon,

I do not have much knowledge of servers and I am having problems configuring my virtual host environment. In addition to setting up a lamp environment, I have created a domain and created a certificate within the droplet. But when I access my web from the ip http://134.122.75.77, it does load although it gives me an error when downloading the images. But when I try to access from the domain, I get a 404 error.

Attached virtual host configuration

sites-available/notasweb.conf

<VirtualHost *:80>
    ServerName notasweb.me
    ServerAlias www.notasweb.me
    ServerAdmin *****@hotmail.com
    DocumentRoot /var/www/notasweb/public

    <Directory /var/www/notasweb/public/>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

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

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.notasweb.me [OR]
    RewriteCond %{SERVER_NAME} =notasweb.me
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
ServerName localhost
****

If you need more information do not hesitate to ask me. Please could you help me.


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.

Hi there,

It sounds like Mod Rewrite is not enabled. You can do that with the following command:

sudo a2enmod rewrite

After that restart Apache to make sure that it loads the new module:

sudo systemctl restart apache2

Let me know how it goes. Best, Bobby