简体   繁体   中英

Laravel 5.2 not loading on server (Ubuntu 14.04)

I have set up a new server and installed fresh laravel copy on it,but if I hit the browser with the url example : 173.22.54.88/public I see the index.php code on the browser.
In the dev tools I see a 304 status code .I haven't updated anything it's a fresh copy also I have given appropriate permissions ie 777 to the storage folder and 755 to rest of the directories. I also added the .htaccess file

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

  RewriteEngine On
  RewriteBase /laravel/public
  # Redirect Trailing Slashes...
  RewriteRule ^(.*)/$ /$1 [L,R=301]

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

The apache logs show me nothing wrong and the laravel logs give the following errors

    #0 /var/www/html/laravel/vendor/symfony/console/Input/ArgvInput.php(88):     Symfony\Component\Console\Input\ArgvInput->parseArgument('compiled')
    #1 /var/www/html/laravel/vendor/symfony/console/Input/Input.php(64):  Symfony\Component\Console\Input\ArgvInput->parse()
    #2 /var/www/html/laravel/vendor/symfony/console/Command/Command.php(221): Symfony\Component\Console\Input\Input->bind(Object(Symfony\Component\Console\Input\InputDefinition))
    #3 /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #4 /var/www/html/laravel/vendor/symfony/console/Application.php(791): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #5 /var/www/html/laravel/vendor/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Foundation\Console\ClearCompiledCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #6 /var/www/html/laravel/vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #7 /var/www/html/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #8 /var/www/html/laravel/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 {main}

Through this I am not able to conclude anything. What could be possible problem over here? I have enabled mod_rewrite

浏览器截图

Use the default .htaccess:

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

#### Munee .htaccess Code Start ####
RewriteRule ^(.*\.(?:css|less|scss|js|coffee|jpg|png|gif|jpeg))$ munee.php?files=/$1 [L,QSA,NC]
#### Munee .htaccess Code End ####

To configure apache site use:

<VirtualHost *:80>
DocumentRoot /PATH/TO/PROJECT/public/
ServerName domain.com
ServerAlias www.domain.com
# Other directives here
</VirtualHost>

Then restart apache and hit the url without /public at the browser, it have to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM