Search code examples
phplaravellaravel-5serverredhat

How to fix, "The requested URL /login was not found on this server" issue on the server end when trying to load a laravel project?


I am setting up my Laravel project on a redhat server. When I load the url, I keep getting greeted with this, "The requested URL /login was not found on this server". However, when I change my httpd.conf to direct my index to DirectoryIndex xxx/public/phpinfo.php, it can load the phpinfo. But when I direct it to my index.php as such; DirectoryIndex xxx/public/index.php, it returns the above error.

Httpd.conf settings;

<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"

<Directory "/var/www">
    AllowOverride None
    Require all granted
</Directory>
<Directory "/var/www/html">
    MultiViews
    AllowOverride None
</Directory>

<Directory /var/www/html/xxx/public/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex xxx/public/index.php
</IfModule>

.htaccess file;

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>
    Options +FollowSymLinks
    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

So I really do not know what I'm doing wrong here, and have been through a lot of threads, but can't get this fixed.


Solution

  • In your /etc/apache2/sites-available/000-default.conf set

    DocumentRoot /var/www/html/yourproject/public
    

    and for

    The stream or file "/var/www/html/jci-backend/storage/logs/laravel-2019-05-02.log" could not be opened: failed to open stream: Permission denied"

    On ubuntu

    change permission using sudo chmod 775 -R /var/www/html/jci-backend/storage/logs/laravel-2019-05-02.log

    On redhat you can try

    sudo chmod o+w /var/www/html/jci-backend/storage/logs/laravel-2019-05-02.log