How to automatically deploy Laravel in Plesk

Modified on Sun, 17 Oct 2021 at 04:46 PM

With the 2020 webhosting plans, you can automatically deploy Laravel in Plesk. The only thing you need is a Git repository (accessible using SSH).

Configure Git

Step 1 Log in to Plesk.

Step 2 Click on Git.

Step 3 Click Add repository.

Step 4 Enter the remote repository. Using the SSH protocol.

Step 5 Copy the generated SSH Public key to your Git repository for read access only.

Step 6 Click OK.

Step 7 Copy .env.example to .env and update the databases settings. Also, set the mail driver to sendmail.

Configure Plesk

Step 1 Log in to Plesk.

Step 2 Click on Hosting Settings.

Step 3 Change the Document root to the public folder in your app. Usually, this is httpdocs/public.

Step 4 Click OK

Run commands for deployments

Step 1 Click on Repository Settings.

Step 2 Enable Enable additional deploy actions.

Step 3 Enter the following:

composer install

Run npm

Use one of the following commands if your deployment requires this. Note: add the required parameters yourself.

# Version 12
/opt/plesk/node/12/bin/npm run production
# Version 10
/opt/plesk/node/10/bin/npm run production
# Version 8
/opt/plesk/node/8/bin/npm run production

For the first time, you may need to run these commands manually using SSH. However, upon the next 

Configure auto-deployment

Plesk can automatically deploy your PHP app.

Step 1 Log in to Plesk.

Step 2 Click on Git.

Step 3 Click on Repository settings.

Step 4 Select Automatic deployment in Select deploy mode.

Step 5 Copy the Webhook URL.

Step 6 Configure in your Git webservice (Github, Gitlab, Bitbucket, etc) the webhook.

Any new commit in the same branch will trigger a deployment of your app in Plesk.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article