Skip to content

<div style="display: none;" hidden="true" aria-hidden="true">Are you an LLM? You can read better optimized documentation at /guides/Plesk_New_Client_Setup_Guide.md for this page in Markdown format</div>

Home | Changelog

🧩 Plesk New Client Setup Guide

1️⃣ Prepare Bitbucket Repository

  1. Open the client’s project repository on Bitbucket.
  2. Copy the clone command (SSH URL) for the repository.
  3. Go to:
    Repository Settings → Access Keys → Add Key
  4. Create a new key labeled PleskKey — you’ll paste the Plesk public SSH key here later.

2️⃣ Configure Plesk Domain

  1. On your server’s Plesk panel, create a new domain.
    Choose the option:
    Deploy using Git

  2. Fill in the following:

    • Repository URL → paste the Bitbucket clone command.
    • Copy the SSH public key generated by Plesk and paste it into Bitbucket’s Access Keys under the label PleskKey.
    • Save the Bitbucket Access Key.
    • Deployment settings → set to Manual.
    • Server path/httpdocs.
    • Leave all other settings as default.
    • Click Create.

3️⃣ Handle Preexisting Client Websites

  • If the client already has an active website, create a domain alias in Plesk using:
    clientwebsite.ecommercen.com
    Example: if the client’s current website is example.com, create example.ecommercen.com.

4️⃣ Prepare Project Files

After domain creation:

  1. Add the following files in the project root:

    • .env → copy from the example and update (see below).
    • auth.json → copy from another existing client.
    • public/.htaccess → copy from example.
  2. Go to:
    Hosting Settings → Document Root

    • Ensure it points to:
      httpdocs/public

5️⃣ Configure PHP Settings

  1. Navigate to:
    PHP Settings
  2. Select the PHP version that matches the project (default is usually the latest installed, e.g., PHP 8.1).
  3. Adjust PHP limits based on project requirements:
    memory_limit = 512M
    max_execution_time = 300
  4. Under Additional Directives, add:
    session.gc_probability = 1
    session.gc_divisor = 1000
    max_input_vars = 3000

6️⃣ Setup auth.json and .env

🔹 auth.json

Copy from another working client and ensure it contains valid Packagist credentials.

🔹 .env

Populate the following values:

APP_ENV=testing
APP_BASE_URL=https://clientdomain.com       # or alias if preexisting
ADMIN_PASSWORD=********
ADVISABLE_PASSWORD=********
DB_DATABASE=clientname_db
DB_USERNAME=clientnameUser
DB_PASSWORD=********
APP_PHP_EXECUTABLE=/opt/plesk/php/8.1/bin/php

Generate Encryption Keys:

Using SSH:

php cli.php utils/generateEncryptionKey
  • Copy the generated key to .env as APP_ENCRYPTION_KEY.

Repeat for:

php cli.php utils/generateEncryptionKey
  • Copy the second key to .env as JWT_ENCRYPTION_KEY.

7️⃣ Create Database

  1. Go to Databases → Add Database.
  2. Set:
    • Database Name: clientname_db
    • Related Site: the client’s domain.
    • Database User: clientnameUser
    • Generate a strong password (avoid special characters if possible).
  3. Copy the DB name, user, and password into your .env.
  4. Return to the Plesk Database creation window:
    • Grant access to all DBs within the subscription.
    • Set Access Control → “Allow local connections only.”
  5. Click Create Database.

8️⃣ Install Dependencies & Run Migrations

  1. In Plesk Git settings, click:

    • Scan
    • Install Composer dependencies
  2. Connect via SSH (WinSCP, PuTTY, or terminal):

    cd /var/www/vhosts/clientdomain.com/httpdocs/
  3. Run migrations and seeds:

    bash
    sudo -u ClientUser /opt/plesk/php/8.1/bin/php migrator.php migrate
    sudo -u ClientUser /opt/plesk/php/8.1/bin/php migrator.php seed:run --seed=InitialSeed

    (Tip: type part of the username and press Tab for autocompletion.)


9️⃣ Setup SSL with Let’s Encrypt

  1. Provide the server’s IP to the person managing Cloudflare.

  2. Once DNS is pointed, go to:
    Plesk → SSL/TLS Certificates

    • Select Install Let’s Encrypt certificate for the domain.
  3. If a 500 error appears after SSL installation:

    • Ensure your .env includes:
      CDN_DISABLE=true
    • If it still persists, clear cached files:
      httpdocs/cache/el/

Your new client’s domain is now fully set up on Plesk!