up +1
Deploy Laravel on dedicated server problem
Hey,
I had a wonderful time with laravel and now I'd like to push it to production but I'm facing some issues right now.
My knowledge in servers administration is limited as such it's hard for me to configure my server.
I'm trying to deploy on a dedicated server, so there should be no problem with any command as I'm a super user.
Here's what I did for the moment using Laravel Envoy :
@servers(['web' => 'root@adress -p 1234'])
@setup
$dir = "/var/www/default";
$shared = $dir .'/shared';
$current = $dir .'/current';
$repo = $dir .'/repo';
$release = $dir."/releases/" .date('YmdHis');
@endsetup
@macro('deploy')
createrelease
composer
linkcurrent
@endmacro
@task('prepare')
mkdir -p {{$dir}};
mkdir -p {{ $repo }};
mkdir -p {{ $shared }}/shared;
cd {{ $repo }};
git init --bare;
@endtask
@task('createrelease')
mkdir -p {{$release}};
cd {{ $repo }};
git archive master | tar -x -C {{$release}};
echo "Creation of {{$release}}";
@endtask
@task('composer')
mkdir -p {{$shared}}/vendor;
ln -s {{$shared}}/vendor {{$release}}/vendor;
cd {{$release}};
composer update --no-dev --no-progress;
@endtask
@task('linkcurrent')
rm -f {{$current}};
ln -s {{$release}} {{$current}};
@endtask
First I trigger the 'prepare' task which inits a bare repository on my server, then after doing thing I'll push everything using this repo. Then the other task are aimed at creating releases folders which if I need to go back in time in case a problem occurs. The rest is handling the dependencies with composer but for the most part the folder 'current' is the one that should be displayed to the user.
As such here is the configuration of my apache2.conf file :
<Directory /var/www/default/current>
Options -Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Include the virtual host configurations:
Include sites-enabled/
sites-enabled/00-default file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/default/current
<Location />
Options FollowSymLinks
AllowOverride All
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sites-available/default file :
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/default/current
<Location />
Options FollowSymLinks
AllowOverride All
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But the result is a 500 Internal server error and I've tried digging into the logs without success. Can't find any. Can someone help me please? Do I need to change something in the public/.htaccess file?
Thanks a lot, i'm kinda lost right now since it's the first time i'm deploying on a server through ssh
Please or to participate in this conversation.