Thursday, September 1, 2022

[SOLVED] Laravel 5.2 shows apache screen instead of index.php

Issue

I checked most of question regarding to my problems as this seems to be very common error for Laravel beginners but I can't find the solutions so far :(

I use the digital ocean VPN, centos7, php5.6, apache, windows 10.

Installed laravel and configured httpd.conf, mysite.com.conf, .htaccess and hosts fies then restart apache but still welcome screen doesn't show and it shows apache screen instead.

+==================================================+

here is my settings...

1) /etc/httpd/conf/httpd.conf

<Directory "/var/www/html">
Options -Indexes +FollowSymLinks
AllowOverride None (default setting)

And added below the end of the file

ServerSignature Off
ServerTokens Prod
IncludeOptional sites-enabled/*.conf

For reference, other default settings are below

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

2) /etc/httpd/sites-available/mysite.com.conf

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mysite.com
ServerAlias mysite.com
DocumentRoot /var/www/mysite.com/public_html
ErrorLog /var/log/httpd/mysite.com_error_log
CustomLog /var/log/httpd/mysite.com_access_log combined
AddDefaultCharset UTF-8
<Directory /var/www/mysite.com/public_html>
  <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
  </IfModule>
  AllowOverride All
</Directory>
</VirtualHost>

3) /var/www/mysite.com/public_html/.htaccess

<IfModule mod_rewrite.c>
 <IfModule mod_negotiation.c>
  Options -MultiViews
 </IfModule>
 RewriteEngine On
 RewriteRule ^(.*)/$ /$1 [L,R=301]
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^ index.php [L]
</IfModule>

4) C:/windows/system32/drivers/etc/hosts

digitaloceanDropletIp mysite.com

5) publi_html folder img

enter image description here

I would be really appreciated if someone can tell me what is wrong my settings. Thanks in advance!


Solution

Change

DocumentRoot /var/www/mysite.com/public_html

To

DocumentRoot /var/www/mysite.com/public_html/public

Then restart your apache



Answered By - KmasterYC
Answer Checked By - Marie Seifert (WPSolving Admin)