0

I have a laravel 5.4 application in a server, and I get this result when I try to test my app.

enter image description here

My virtual host file

<VirtualHost *:80>
ServerName plataformafoodif.cl
DocumentRoot "/var/www/html/Plataforma-FoodIf/public"
ServerAlias www.plataformafoodif.cl
 <Directory "/var/www/html/Plataforma-FoodIf/public">
   Options All
   AllowOverride All
   Allow from all
 </Directory>
</VirtualHost>

My index.php file

<?php

 require __DIR__.'/../bootstrap/autoload.php';
 $app = require_once __DIR__.'/../bootstrap/app.php';

My .htaccess file

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

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

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

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


</IfModule>

My hosts file

# Generated by SolusVM
127.0.0.1       localhost localhost.localdomain
::1     localhost localhost.localdomain
# 168.232.167.108       FRESBOX.CL
168.232.167.108 plataformafoodif.cl

Also on my .env I have

APP_ENV=local
APP_DEBUG=true
APP_KEY=someRandomKey
APP_LOG_LEVE=debug
APP_URL=http://168.232.167.108

Any help would be really appreciated, I have spent many hours trying to fix this

Micho
  • 3,929
  • 13
  • 37
  • 40
Ukarus
  • 3
  • 1
  • 5
  • i hope you have index.php in the root of your domain – madalinivascu Dec 21 '17 at 05:10
  • Have you made sure that mod_rewrite is actually enabled? Assuming you are on a linux distribution you should be able to run: `apache2 a2enmod rewrite`. Then restart your apache. – Nick Tucci Dec 21 '17 at 05:10
  • Are you 100% sure you have installed PHP? – Nick Tucci Dec 21 '17 at 05:12
  • Possible duplicate of [PHP code is not being executed, instead code shows on the page](https://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-instead-code-shows-on-the-page) – iainn Dec 21 '17 at 10:36

2 Answers2

0

Hi there can you try this:-

<VirtualHost *:80>
ServerName plataformafoodif.cl
DocumentRoot "/var/www/html/Plataforma-FoodIf/public"
ServerAlias www.plataformafoodif.cl
 <Directory "/var/www/html/Plataforma-FoodIf">
   Options All
   AllowOverride All
   Allow from all
 </Directory>
</VirtualHost>

and also you have to configure the apache2.config file.

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

You will find the above code in your apache2.conf file where you add your path to the third directory.

And then reload the apache server. I hope this helps your problem.

0

In the end it was this

<IfModule dir_module>
   DirectoryIndex index.html
</IfModule>

I've changed to index.php to match my file on public and i also added the php module line

LoadModule php7_module modules/libphp7.so

Thanks your all your help

Ukarus
  • 3
  • 1
  • 5