Problemas de configuração do Ubuntu / 14.04 / Apache2? Não tenho certeza do que estou fazendo errado Laravel: rota padrão será renderizada, mas outras não.

0

O Laravel renderizará a página padrão / raiz normalmente. mas não processará rotas padrão ou páginas de erro. Meu navegador retornará com as páginas de erro do Apache (NOT Laravel) com o qual tento acessar / testar

Aqui estão algumas informações (por favor, deixe-me saber se você precisar de mais detalhes)

Árvore de diretórios do servidor

/var/www/
└── html
    ├── access.log
    ├── app
    ├── artisan
    ├── bootstrap
    ├── composer.json
    ├── composer.lock
    ├── config
    ├── database
    ├── error.log
    ├── gulpfile.js
    ├── package.json
    ├── phpspec.yml
    ├── phpunit.xml
    ├── public
    ├── readme.md
    ├── resources
    ├── server.php
    ├── storage
    ├── tests
    └── vendor

Exibições (a visualização de teste é uma cópia da exibição de boas-vindas padrão)

/var/www/html/resources/views/
├── errors
│   └── 503.blade.php
├── test.blade.php
├── vendor
└── welcome.blade.php    

Rotas

<?php    

Route::get('/', function () {
    return view('welcome');
});    


Route::get('test', function () {
    return view('test');
});    


Route::get('anotherTest', function () {
    return 'Hello World';
});   

Configuração do Apache

<VirtualHost *:80>    

    # The location of our projects public directory.
    DocumentRoot    /var/www/html/public    

    # Useful logs for debug.
    CustomLog       /var/www/html/access.log common
    ErrorLog        /var/www/html/error.log    

    # Rewrites for pretty URLs, better not to rely on .htaccess.
    <Directory /www/var/html>
        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>
    </Directory>    

</VirtualHost>

usando o arquivo .htaacess padrão (fornecido)

<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]
</IfModule>

Além disso, meu log de erros está vazio Mas o log de acesso mostra 404 e 496

admini@linux:/var/www/html$ cat error.log
admini@linux:/var/www/html$ cat access.log
192.168.1.130 - - [24/Jul/2015:15:51:53 -0700] "GET / HTTP/1.1" 200 1448
192.168.1.130 - - [24/Jul/2015:15:54:46 -0700] "GET /test HTTP/1.1" 404 496
192.168.1.130 - - [24/Jul/2015:15:56:37 -0700] "GET /test HTTP/1.1" 404 496
192.168.1.130 - - [24/Jul/2015:15:57:11 -0700] "GET /test HTTP/1.1" 404 496
192.168.1.130 - - [24/Jul/2015:15:57:13 -0700] "GET /test HTTP/1.1" 404 495
192.168.1.130 - - [24/Jul/2015:16:14:53 -0700] "GET /test HTTP/1.1" 404 496
192.168.1.130 - - [24/Jul/2015:16:14:53 -0700] "GET /test HTTP/1.1" 404 495
192.168.1.130 - - [24/Jul/2015:16:18:16 -0700] "GET /test HTTP/1.1" 404 496
192.168.1.130 - - [24/Jul/2015:16:18:17 -0700] "GET /test HTTP/1.1" 404 495
admini@linux:/var/www/html$
    
por user136952 25.07.2015 / 02:05

1 resposta

1

Alterar meu arquivo de configuração do Apache para o problema abaixo resolveu o problema.

<VirtualHost *:80>
    ServerName somehost
    DocumentRoot /var/www/html/public    

    CustomLog       /var/www/html/access.log common
    ErrorLog        /var/www/html/error.log    

   <Directory /var/www/html/public>
      <IfModule mod_rewrite.c>
      Options -MultiViews
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^ index.php [L]
   </IfModule>
</Directory>
</VirtualHost>    
    
por user136952 25.07.2015 / 23:04