0

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. At this point, any help would really be appreciated. Thanks in advance!

Prafulla Kumar Sahu
  • 9,321
  • 11
  • 68
  • 105
Udhayan Nair
  • 550
  • 1
  • 8
  • 18

1 Answers1

1

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
Prafulla Kumar Sahu
  • 9,321
  • 11
  • 68
  • 105
  • hey thanks for this. However my server is running on redhat, the sudo chmod command wont work, as its a different handler. – Udhayan Nair May 02 '19 at 03:32
  • @UdhayanNair I have updated my answer, can you try that? – Prafulla Kumar Sahu May 02 '19 at 03:34
  • hey, so ive tried that command line, and the weirdest thing happened, it says that it cannot access '/var/www/html/jci-backend/storage/logs/laravel-2019-05-02.log' as theres's no such directory or file. and when i went in tocheck, there was no such log. :/ – Udhayan Nair May 02 '19 at 03:40
  • @UdhayanNair it depends on where you are and from current location what is the relative path of file, for which you are changing the permission. – Prafulla Kumar Sahu May 02 '19 at 03:43
  • @UdhayanNair by the way, it is a different question and you can find the answer here https://stackoverflow.com/questions/23411520/how-to-fix-error-laravel-log-could-not-be-opened/44647615 – Prafulla Kumar Sahu May 02 '19 at 03:45
  • i've followed the steps accordingly, but i still get the error. – Udhayan Nair May 02 '19 at 03:57
  • "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" the same error – Udhayan Nair May 02 '19 at 03:59
  • @UdhayanNair then change the permissions for storage/logs folder and check again and let me know if it solves your problem. – Prafulla Kumar Sahu May 02 '19 at 04:03
  • nope, just tried chmod 775 -R storage/logs, it didnt work. i executed teh same command for storage, and my jci-backend folder as well. didnt work.. – Udhayan Nair May 02 '19 at 04:05
  • managed to get it to work by following this; https://stackoverflow.com/questions/30306315/laravel-5-laravel-log-could-not-be-opened-permission-denied/36658378 – Udhayan Nair May 02 '19 at 04:20
  • but now i get this. "Mixed Content: The page at 'https://xxi.com/login' was loaded over HTTPS, but requested an insecure stylesheet 'http://xxi.com/css/bootstrap.min.css'. This request has been blocked; the content must be served over HTTPS." – Udhayan Nair May 02 '19 at 04:21
  • @UdhayanNair check if all your css and js are loading with either http or https and not both. – Prafulla Kumar Sahu May 02 '19 at 04:23
  • its loading via http. damn. in my code, i set the `href="{{ asset('css/bootstrap.min.css') }}"` i jsut need to set itso that asset caters for http and https right? – Udhayan Nair May 02 '19 at 04:30
  • @UdhayanNair try it. – Prafulla Kumar Sahu May 02 '19 at 04:33
  • @UdhayanNair if your domain has https use https or make all http and it should work fine. – Prafulla Kumar Sahu May 02 '19 at 04:34