Sitemap

Laravel 5.2 shows apache screen instead of index.php

2 min readSep 25, 2024

--

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…

Get Ted James’s stories in your inbox

Join Medium for free to get updates from this writer.

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 admin@mysite.com
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 — Cary Denson (FixIt Admin)

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

creative-commons-by-21pxcreative-commons-sa-21px

--

--

Ted James
Ted James

Written by Ted James

The world is my office, and every destination is my inspiration