Skip to content

Instantly share code, notes, and snippets.

@rseon
Last active April 26, 2021 10:34
Show Gist options
  • Save rseon/7fc14f97115ea23a7df4c70c06df25d1 to your computer and use it in GitHub Desktop.
Save rseon/7fc14f97115ea23a7df4c70c06df25d1 to your computer and use it in GitHub Desktop.
Clone a Laravel repository

Clone a Laravel repository

Or anything else from Github.

Retrieve and install the project

git clone https://github.com/me/my-project.git
chown -R www-data:www-data my-project
cd my-project
composer install

Create hosting

Create new file /etc/apache2/sites-available/my-project.conf with content :

<VirtualHost *:80>
    ServerAdmin [email protected]

    ServerName my-project.my-domain.com
    DocumentRoot /home/web/my-project/public

    <Directory /home/web/my-project>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/apache2/com.my-domain.my-project-error.log
    CustomLog /var/log/apache2/com.my-domain.my-project-access.log combined
</Virtualhost>

Activate : a2ensite my-project.conf

Reload Apache : systemctl reload apache2

Database :

mysql -u root -p <<EOFMYSQL
CREATE DATABASE \`my-project\`;
GRANT ALL PRIVILEGES ON \`my-project\`.* TO \`my-project\`@localhost IDENTIFIED BY 'mysuperpassword';
FLUSH PRIVILEGES;
EOFMYSQL

HTTPS

Follow instructions on the Cerbot website then :

  • sudo certbot --apache
  • Choose site to activate
  • Choose 2 for automatic redirection

Configure Laravel

cp .env.example .env
php artisan storage:link
php artisan key:generate
chown -R www-data:www-data .

Put correct data in .env file, then :

php artisan migrate
php artisan db:seed

Enjoy at https://my-project.my-domain.com !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment