Reputation: 441
I have two servers - local (laravel homestead in ubuntu desktop) and public (ubuntu server with php7) for my websites. I already have a few simple websites that works fine on my public server and they are visible to the net. I create laravel 5.2 project on my laravel Homestead local server and now I want to move it - deploy it to my public server. I compress complete project folder (tar.gz) and move it to server using filezilla and unpack and navigate domain DocumentRoot to the project index.php page in public folder but it's opening a blank page. If I make a change in index.php and echo some string, it's work and string is displayed but laravel bootstrap doesn't load application. My index.php is located in:
/var/www/html/mydomain.com/public/index.php
with this two line:
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
and this:
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
I try also with absolute path:
require '/var/www/html/mydomain.com/bootstrap/autoload.php';
$app = require_once '/var/www/html/mydomain.com/bootstrap/app.php';
But browser still opening blank page. Apache configuration file (/etc/apache2/sites-available/mydomain.com.conf) for this domain is created with this data:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/html/mydomain.com/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
This is my first laravel project and I don't have experience with deploying it on server. Please, what setup and changes I need to do to make it works? Domain is navigated to the index.php page in public folder but browser doesn't loading aplication. Please some help.
Edit: Error log from apache:
[Sun Jul 10 21:38:26.082328 2016] [:error] [pid 18269] [client 192.168.1.7:41368] PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/mydomain.com/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/mydomain.com/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /var/www/html/mydomain.com/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/html/mydomain.com/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/mydomain.com/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#3 /var/www/html/mydomain.com/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#4 /var/www/html/mydomain.com/vendor/laravel/framework/ in /var/www/html/mydomain.com/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87
Upvotes: 0
Views: 734
Reputation: 348
You have to setup the permissions of your folders and files correctly. You can find a lot of info in this question. File permissions for Laravel 5 (and others)
Also why don't you use git to deploy your project? Make a repo and then you can clone your project on your server and when you update your site all you have to do is a git pull :) And if you realy want to do it the right way you can use a deploybot with Envoy. This way you can directly deploy from your local machine.
Upvotes: 0